xcode 分配“堆快照”中的 <non-object> 是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4079253/
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
What does <non-object> in Allocation "heapshots" mean?
提问by sniurkst
I'm having a hard time fixing memory related issues in my iPad application, but, good thing is, that I've learned about "heapshots" because of that. Bad thing is, I'm still unable to figure out what some of the information provided to me means.
我很难解决 iPad 应用程序中与内存相关的问题,但好在我因此了解了“堆快照”。糟糕的是,我仍然无法弄清楚提供给我的一些信息意味着什么。
So, what are these non-objects which are still alive and takes most of the memory described in Heap Growth? Is it possible to get rid of them? It looks like that most of them are related to various drawing operations, CALayer, context and etc (Category:"Malloc" or "Realloc"). I can provide more details if needed.
那么,这些仍然活着并占据堆增长中描述的大部分内存的非对象是什么?有没有可能摆脱它们?看起来它们中的大多数都与各种绘图操作、CALayer、上下文等(类别:“Malloc”或“Realloc”)有关。如果需要,我可以提供更多详细信息。
采纳答案by Yuras
It means that memory block was allocated not for an object (e.g. pure c structure). Usually they are allocated by system framework code, so there are some other objects that leaks. E.g. if you forgot to release UIView, then it's layer will not be freed too.
这意味着内存块不是为对象分配的(例如纯 c 结构)。通常它们是由系统框架代码分配的,所以还有一些其他的对象会泄漏。例如,如果你忘记释放 UIView,那么它的层也不会被释放。
You can open "Extended detail" panel (see "View" menu) and analyze the call stack. Take in mind that one release
you forgot can lead to a lot of memory leaks, so try to fix the easiest leaks and then check whether other leaks disappears.
您可以打开“扩展详细信息”面板(请参阅“查看”菜单)并分析调用堆栈。请记住,release
您忘记的一个可能会导致大量内存泄漏,因此请尝试修复最简单的泄漏,然后检查其他泄漏是否消失。
One more trick. You can disable functional block of your application one by one and see whether leaks disappears. So you will be able to locate module (class, functional block, etc) where it occurs.
又一招。您可以将应用程序的功能块一一禁用,看看泄漏是否消失。因此,您将能够找到模块(类、功能块等)出现的位置。