I am developing an app that is crashing due to an excess of memory usage. I would like to know the amount of memory that is being used by each active thread so that I can decide which allocated or drawn in screen elements release or remove from view. Is there a way to obtain it?
I have tried using mach.h library but with mach_task_self()
I can only access the memory used by the whole application.
Thanks in advance
I think what you want is logMemUsage()
.
You can check the Answer from this Question : Watching memory usage in iOS
I think you can get something from this Documentation also : Understanding and Analyzing iOS Application Crash Reports
If you want to check Memory Usage While Application is Running then use Instruments . :
Using Instruments
you can check how much memory your app is using. In Xcode4
, use ' Profile
' build, choose Leaks
, then click the Library
button in the toolbar and add the Memory Monitor instrument
.
If you really don't want to use Instruments then you can use Custom Class UIDeviceAdditions
: Get current Memory usage
Hope it's Enough.
You can't because threads share the heap. Threads are created with a 512KB stack space , with memory pages allocated as needed. Other than that, there is no memory per thread value stored anywhere.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.