【问题标题】:iOS profiling allocations not showing UIImage object created through codeiOS 分析分配不显示通过代码创建的 UIImage 对象
【发布时间】:2012-08-16 11:42:58
【问题描述】:

我很少分析 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 中显示的总大小远小于预期。还有为什么上面的alloc没有在内存分配中列出。

【问题讨论】:

    标签: ios memory-leaks xcode-instruments


    【解决方案1】:

    在这里查看https://stackoverflow.com/a/7575099/314983 分配工具不包括 OpenGL ES 消耗的内存 - UIImage 的数据实际上是由 OpenGL ES 使用的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多