Iphone 对手动生成的线程打印调用UIGetScreenImage()_NSAutoreleaseNoPool():“;要记录的消息
这是在Iphone 对手动生成的线程打印调用UIGetScreenImage()_NSAutoreleaseNoPool():“;要记录的消息,iphone,screen-scraping,nsthread,nsautoreleasepool,Iphone,Screen Scraping,Nsthread,Nsautoreleasepool,这是在NSThread+detachNewThreadSelector:(SEL)选择器toTarget:(id)或TargetWithObject:(id)参数中指定的选择器主体 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while (doIt) { if (doItForSure) { NSLog(@"checking");
NSThread+detachNewThreadSelector:(SEL)选择器toTarget:(id)或TargetWithObject:(id)参数中指定的选择器主体
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
while (doIt)
{
if (doItForSure)
{
NSLog(@"checking");
doItForSure = NO;
(void)gettimeofday(&start, NULL);
/*
do some stuff */
// the next line prints "_NSAutoreleaseNoPool():" message to the log
CGImageRef screenImage = UIGetScreenImage();
/*
do some other stuff */
(void)gettimeofday(&end, NULL);
elapsed = ((double)(end.tv_sec) + (double)(end.tv_usec) / 1000000) - ((double)(start.tv_sec) + (double)(start.tv_usec) / 1000000);
NSLog(@"Time elapsed: %e", elapsed);
[pool drain];
}
}
[pool release];
其他人是否在单独的线程上使用UIGetScreenImage()
看到过这一点?[pool drain]
在iOS上的行为与[pool release]
相同。因此,在while循环的第一次迭代之后,您最终没有自动释放池。拆下排水管
,您应该会没事的。但是,不确定在主线程以外的线程中使用UIGetScreenImage()是否可以
2010-05-03 11:39:04.588 ProjectName[763:5903] *** _NSAutoreleaseNoPool(): Object 0x15a2e0 of class NSCFNumber autoreleased with no pool in place - just leaking