Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Memory graph / chart in XCode 5 during Debug

What does "Memory" usage chart/graph exactly represents in XCode 5 Debug navigator window?

I have an iOS app project with ARC disabled and no-storyboard/xib (i.e. old style). All memory management done manually using retain/release/autorelease.

When I debug the project in XCode 5, the memory pie-chart / graph show gradually increasing memory usage as the app runs, exceeds 1 GB memory footprints within half hour.

Roughly, it keeps increasing by 0.1 to 0.3 MB per 2 to 3 second with very rare memory dips/decrease (of magnitude < 0.1 MB per 30 seconds).

enter image description here

Is this a concern (memory leak) with respect to memory management? I did memory analysis (using Allocations/Memory Leak through Instruments on XCode 4.6) but didn't find any leaks.

like image 373
Ashok Avatar asked Oct 16 '13 02:10

Ashok


People also ask

How do I see memory management in Xcode?

While your app is running in Xcode, the memory report available from Xcode's Debug navigator shows the app's current memory use, along with the highest value seen. The yellow region of the memory gauge indicates memory use high enough to trigger a warning.

What is malloc stack logging?

Description. MallocStackLogging. If set, malloc remembers the function call stack at the time of each allocation. MallocStackLoggingNoCompact. This option is similar to MallocStackLogging but makes sure that all allocations are logged, no matter how small or how short lived the buffer may be.


2 Answers

Found answer myself. Unfortunately I had NSZombieEnabled (Zombie object) for debug mode - see below - (menu Product > Scheme > Edit Scheme)

enter image description here

Typically NSZombieEnabled tool keeps even the released objects in memory to help developer find over released objects. Refer this link - What is NSZombie?

After I unchecked "Enable Zombie Objects" option, the memory usage stabilized to about 10 mb (not always increasing) even after half hour app usage - see below -

enter image description here

BOTTOM LINE - Ensure to clear "Enable Zombie Objects" when you want to analyze memory usage.

like image 70
Ashok Avatar answered Sep 28 '22 09:09

Ashok


It simply measures the memory your app uses. So if it is increasing it must be a memory leak.

When using the leak analysis tools, I would use it as a guideline. It may help you find leaks but with all automated tools it may not find it all. As certain pieces of code (Especially the more dynamic pieces) may be hard to predict what they do memory wise for an automated tool.

like image 24
James Campbell Avatar answered Sep 28 '22 10:09

James Campbell