XCode Instruments 分配:查看实时字节数还是总字节数?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7574364/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 22:02:46  来源:igfitidea点击:

XCode Instruments Allocations: Look at Live Bytes or Overall Bytes?

iosxcodememory-managementinstruments

提问by Nic Hubbard

I am getting some memory warning in my iOS app so I am running Instruments to see the allocations. Should I look at the * All Allocations * Live Bytes or Overall Bytes?

我在 iOS 应用程序中收到一些内存警告,因此我正在运行 Instruments 以查看分配情况。我应该查看 * 所有分配 * 实时字节数还是总字节数?

Someone said the iOS can close my app if I use for 22MB, is that from the Live or Overall bytes section?

有人说如果我使用 22MB,iOS 可以关闭我的应用程序,是来自 Live 还是 Total bytes 部分?

enter image description here

在此处输入图片说明

回答by zaph

Live Bytes is the current usage and is what you are interested in, overall bytes includes all released allocation. The other thing is to look at the graph and look for peaks. As an example I saw a huge peak of about 27MB in an app I was working on, knowing that I was able to reduce peak memory usage to 8MB.

Live Bytes 是当前的使用情况,也是您感兴趣的,总字节数包括所有已释放的分配。另一件事是查看图表并寻找峰值。例如,我在我正在开发的应用程序中看到了大约 27MB 的巨大峰值,因为我知道我能够将峰值内存使用量减少到 8MB。

Also watch over time as you exercise your app, it is possible to have substantial memory growth over time that is not leaked, just not not used anymore.

在您运行您的应用程序时也要注意,随着时间的推移,可能会有大量内存增长,而不会泄漏,只是不再使用。

For a description of the memory columns see Explanation of Live Bytes & Overall Bytes.

有关内存列的说明,请参阅Live Bytes 和 Total Bytes 的说明