您如何看待XCode Instruments中负责内存分配的特定方法? [英] How do you see the specific methods responsible for memory allocation in XCode Instruments?

查看:96
本文介绍了您如何看待XCode Instruments中负责内存分配的特定方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人要求我尝试减少给出的应用程序代码中的内存使用量.该应用程序可以在模拟器中正常运行,但是在设备上已终止,或者在调试时进入了已暂停"状态,并且在设备上关闭了.

I've been asked to try and reduce memory usage in an app's code I have been given. The app runs fine in the simulator but on the device it is terminated or something, when debugging it enters a 'Paused' state and the app closes on the device.

在运行仪器时,我发现泄漏,将其修复,但是正在进行大量分配.启动后几秒钟内,仪器分配跟踪显示"Malloc 16字节"为1,021 KB.这本质上是无用的信息,我需要查看内存的分配位置,但似乎找不到任何有用的信息.我可以进行更深入检查的是,"dyld","libsystem_c.dylib","libCGFreetype.A.dylib"等分配了大量资源,但是负责的调用者从来都不是应用程序源中可识别的方法.

When running instruments I discovered leaks, fixed them, however there is a large amount of allocation going on. Within a few seconds of launch the instruments allocation trace shows 1,021 KB for 'Malloc 16 Bytes'. This is essentially useless information as is, I need to see where the memory is being allocated but I can't seem to find anything useful. All i can get for a deeper inspection is that 'dyld', 'libsystem_c.dylib', 'libCGFreetype.A.dylib' etc are allocating a lot, but the responsible caller is never a recognizable method from the app source.

我如何查看导致最大分配的方法在这里?我需要降低这种用法!谢谢

How can I see what methods are causing the most allocations here? I need to get this usage down! Thank you

推荐答案

打开扩展的详细信息视图将显示用于内存分配的调用堆栈.选择视图">扩展详细信息"以打开扩展的详细信息视图.

Opening the extended detail view will show the call stack for memory allocations. Choose View > Extended Detail to open the extended detail view.

切换到调用树视图将帮助您找到要在代码中分配内存的位置.使用跳转栏切换到呼叫树视图.

Switching to the call tree view will help you find where you are allocating memory in your code. Use the jump bar to switch to the call tree view.

这篇关于您如何看待XCode Instruments中负责内存分配的特定方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆