Xcode Instruments: peak RAM of iPhone apps running in Simulator?

让人想犯罪 __ 提交于 2019-12-05 03:10:44

问题


Is Activity Monitor (a.k.a. Memory Monitor) the only tool in Xcode Instruments that can measure the total app RAM usage of an iPhone app running in Simulator? Just that line showing momentary wired RAM?

And how accurate is that versus iPhone hardware, especially given OSX paging i/o to VM?

I'm seeing 7-8MB wired RAM figures for just the default Xcode iPhone project templates (other than OpenGL) compiled and running. At the same time Object Allocations shows well under 1MB for all objects.


回答1:


Nope, there's a much better way to do it.

Go to the Run menu and select Run with Performance Tool then Object Allocations.

This will start Instruments and will show RAM usage. It's also useful for detecting memory leaks if you choose Leaks instead of Object Allocations.




回答2:


I would agree, since the Simulator is just an "API simulator", the behavior you see is going to be at least somewhat dependent how OS X manages memory. And the restrictions are obviously different, for example you can exceed 128 MB of ram, or even 256 MB, which obviously isn't possible on any current iPhone or iPod Touch (at least, as of this writing...).

I've still found it useful in OpenGL for making sure textures and other items are properly deallocated, but beyond that, it's just a rough guideline.

However, if you want to see memory usage on device, there's a simple enough solution. Just target Device in Xcode, and go to Run > Run with Performance Tool > Object Allocations, then the build will be sent to the device and the Object Allocations tool will pop up next to Xcode and show on device memory usage.



来源:https://stackoverflow.com/questions/2153271/xcode-instruments-peak-ram-of-iphone-apps-running-in-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!