Instruments ObjectAlloc:实时字节和动态字节的解释总字节数
我正在使用 Instument 的 ObjectAlloc 工具来尝试了解我的应用程序 (iPhone) 的内存正在做什么以及它在何时何地执行此操作。
我真的很想对这些统计数据进行基本解释:
- Live Bytes
- #Living
- #Transitory
- Total Bytes
当我试图计算出我的应用程序使用了多少内存时,我应该查看 Live Bytes 还是 Total Bytes?这是否包括泄漏的内存?什么是瞬态对象?
谢谢
I'm using Instument's ObjectAlloc tool in an attempt to understand what the memory my application (iPhone) is doing and when and where it is doing it.
I would really like a basic explanation of these statistics:
- Live Bytes
- #Living
- #Transitory
- Overall Bytes
When I am trying to work out how much memory my application is using, am I to look at Live Bytes or Overall Bytes? Does this include leaked memory? What are Transitory objects?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ObjectAlloc
跟踪程序运行期间的所有内存分配和释放。活动字节或净字节
是您在时间线中选择的时间您的应用程序正在使用的内存量。这将包括泄漏的内存,因为泄漏的内存永远不会被释放。#Living
是发生了多少次特定大小/对象类型的分配(并且仍在分配)。这在查找泄漏时非常有用。例如,如果您重复执行某个操作(例如进入或退出模态视图控制器),并且您看到对象的
#Living
每次都会增长相同的量,那么您就是可能会泄漏这些对象。然后,您可以通过深入查看并查看分配对象的确切代码行来进行确认,甚至可以查看每个对象的创建时间索引。总字节
包括已释放的内存。出于性能优化的目的跟踪该数字很有用,但如果您只是想查看当前的内存占用量或查找泄漏,那么跟踪该数字就没有用了。ObjectAlloc
tracks all memory allocation and deallocation over the time your program is running.The
Living bytes, or Net bytes
is how much memory your application is using at the time you select in the timeline. That will include leaked memory, since leaked memory is never deallocated.#Living
is how many allocations of a certain size/object type happened (and are still allocated). This is very useful when looking for leaks.For example, if you repetitively perform an action (like coming in an out of a modal view controller), and you see that
#Living
of an object grows by the same amount each time, then you're probably leaking those objects. You can then confirm by drilling down and seeing the exact line of code that is allocating the objects, and even see the time index each one was created.Overall bytes
includes memory that has been released. It's useful to track that number for performance optimization purposes, but not if you're just trying to see your current memory footprint or look for leaks.来自苹果文档的统计解释。
文档链接
< img src="https://i.sstatic.net/6yS7d.png" alt="在此处输入图像描述">
Stats explanation from apple docs.
Link to the document