0

当按下 UIButton 从文件中加载图像以进行滚动视图时,它会在仪器中泄漏

泄漏的对象是 UIImage

大小为 48 字节

负责任的图书馆是基础

负责框架是_NSThread_main_

当我单击地址箭头以获取历史记录时

类别 事件类型 RefCt 大小 责任库 责任调用者

Malloc 32 字节 Malloc 1 32 libsystem_c.dylib strdup Malloc 32 字节空闲 0 -32 libsystem_c.dylib asl_client_release UIImage Malloc 1 48 Foundation NSThread_main UIImage Retain 2 0 Foundation NSThread_main UIImage Retain 3 0 Foundation __NSThreadPerformPerform UIImage Retain 4 0 Foundation __NSThreadPerformPerform UIImage Release 3 0 Foundation __NSThreadPerformPerform UIImage Retain 4 0 Foundation -[NSInvocationOperation main] UIImage Retain 5 0 Foundation -[NSInvocationOperation main] UIImage Release 4 0 Foundation -[NSInvocationOperation main] UIImage Release 3 0 Foundation -[NSInvocationOperation main] UIImage Release 2 0 Foundation __NSThreadPerformPerform UIImage Release 1 0 Foundation -[NSInvocationOperation dealloc]

-(void)ScrollView:(id)sender
{
NSMutableArray *photos = [[[NSMutableArray alloc] init]autorelease];

Photo *photo;

photo = [Photo photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"image0" ofType:@"png"]];
[photos addObject:photo];

photo = [Photo photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"image1" ofType:@"png"]];
[photos addObject:photo];

photo = [Photo photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"image2" ofType:@"png"]];
[photos addObject:photo];

photo = [Photo photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"image3" ofType:@"png"]];
[photos addObject:photo];

photo = [Photo photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"image4" ofType:@"png"]];
[photos addObject:photo];

photo = [Photo photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"image5" ofType:@"png"]];
[photos addObject:photo];

 ImageViewController *imageviewcontroller = [[[ImageViewController alloc] initWithPhotos:photos]autorelease];

imageviewcontroller.displayActionButton = YES;

UINavigationController *navigationController = [[[UINavigationController alloc]
                                                initWithRootViewController:imageviewcontroller]autorelease];

navigationController.navigationBar.tintColor = [UIColor clearColor];

[self presentViewController:navigationController animated:YES completion:NULL];
}

 + (Photo *)photoWithFilePath:(NSString *)path {
return [[[Photo alloc] initWithFilePath:path]autorelease];

如果有人可以就问题可能提出一些想法,那将不胜感激。

提前致谢。

4

0 回答 0