xcode 检查仪器中的内存分配

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1061235/
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 18:38:27  来源:igfitidea点击:

Checking memory allocation in Instruments

iphonexcodedebuggingmemory-leaksinstruments

提问by mac_55

I've cleared my app of leaks using the leaks tool, but I still notice that the objectalloc tool jumps up in the number of objects allocated and footprint when I switch views.

我已经使用泄漏工具清除了我的应用程序的泄漏,但我仍然注意到,当我切换视图时,objectalloc 工具在分配的对象数量和占用空间中跳跃。

I'm especially seeing high numbers of:

我特别看到大量的:

GeneralBlock-16 with mostly Foundation responsible with caller NSLogv

GeneralBlock-16 主要由 Foundation 负责调用者 NSLogv

and

GeneralBlock-0 with mostly QuartzCore responsible

GeneralBlock-0 主要负责 QuartzCore

Any tips on what I can do to further debug this?

关于我可以做些什么来进一步调试的任何提示?

Thanks!

谢谢!

回答by Tim

The ObjectAlloc tool is designed to graph total object allocation over time, and it doesn't take deallocations into account. Essentially: it will always go up.

ObjectAlloc 工具旨在绘制随时间变化的总对象分配,并且不考虑解除分配。本质上:它会一直上升

What you can do is look at the Net Bytes and # Net columns. These columns willadjust based on the number of objects you deallocate, and if you're concerned about total object allocation you can use these to gauge your program's performance.

您可以做的是查看 Net Bytes 和 # Net 列。这些列根据您释放的对象数量进行调整,如果您担心总对象分配,您可以使用这些来衡量您的程序的性能。

You can take a look at this threadon the Apple Support forums - it deals more with what Instruments measures and how you can test your app.

您可以在 Apple 支持论坛上查看此主题- 它更多地涉及 Instruments 测量的内容以及如何测试您的应用程序。

回答by Alex

You should check out http://developer.apple.com/videos/wwdc/2010/?id=311.

您应该查看http://developer.apple.com/videos/wwdc/2010/?id=311

Great video from WWDC 2010 about memory analysis with Instruments.

来自 WWDC 2010 的关于使用 Instruments 进行内存分析的精彩视频。