0
CGRect myImageRect = CGRectMake(3165, 1197, 332,43);
UILabel *myLabel = [[UILabel alloc] initWithFrame:myImageRect];
myLabel.text = @"WASHINGTON D. C.";

NSAutoreleaseNoPool():UICFFont 类的对象 0x7a39750 自动释放,没有池到位 - 只是泄漏 NSAutoreleaseNoPool():UITextRenderingAttributes 类的对象 0x6fc3920 自动释放,没有池到位 - 只是泄漏

上面代码中断点的堆栈跟踪可以在这里找到:img52.imageshack.us/img52/9616/tutc.png

我正在使用 iPhone WWDC 2010 - 104 PhotoScroller(它包括 Tiling View.h)

如何解决这个问题呢 ?

4

1 回答 1

3

此代码是否在后台线程上运行?

您需要创建一个自动释放池

// At the start of your thread
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

...
CGRect myImageRect = CGRectMake(3165, 1197, 332,43);
UILabel *myLabel = [[UILabel alloc] initWithFrame:myImageRect];
myLabel.text = @"WASHINGTON D. C.";
...

// At the very end of your thread
[pool release];
于 2010-12-12T15:35:03.367 回答