我很少分析UIImageView和UIImage的内存分配情况。
为此,我在图像视图中加载了一个大小为2.1MB的图像,但当我通过xcode-instruments分析内存分配时,它显示活动字节为741.50KB,总字节为1.56MB。
查看所有内存分配的列表,我找不到我调用的alloc条目。
这是我的视图控制器中的代码。
self.imageView.image = [[[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"img_background" ofType:@"png"]] autorelease];我只是想知道为什么xcode-instrument中显示的总大小比预期的要小得多。另外,为什么上面的分配没有在内存分配中列出。
发布于 2012-08-29 18:18:54
Check here https://stackoverflow.com/a/7575099/314983 Allocation instrument不包括OpenGL ES消耗的内存- UIImage的数据实际上由OpenGL ES使用。
https://stackoverflow.com/questions/12049602
复制相似问题