CGRect myImageRect = CGRectMake(3165, 1197, 332,43);
UILabel *myLabel = [[UILabel alloc] initWithFrame:myImageRect];
myLabel.text = @"WASHINGTON D. C.";
NSAutoreleaseNoPool():Object UICFFont类的0x7a39750 自动释放,没有游泳池 - 刚刚泄漏NSAutoreleaseNoPool(): 类的对象0x6fc3920 UITextRenderingAttributes自动释放 没有游泳池 - 只是泄漏
上面代码中断点的堆栈跟踪可以在这里找到:img52.imageshack.us/img52/9616/tutc.png
我正在使用iPhone WWDC 2010 - 104 PhotoScroller(包括Tiling View.h)
如何解决这个问题?
答案 0 :(得分: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];