Reputation: 165
I am trying to understand the "All Heap & Anonymous VM" inside Instruments / Allocation.
This is the thing: I just create a new Swift SpriteKit project and without doing anything I got the next results:
As you can see, the heaps are growing up. Nevertheless I don't have memory Leaks. How can I explain that? Is this a good result?
Upvotes: 4
Views: 6022
Reputation: 2127
Information of Allocation doesn't include using of VRAM(Video Memory), so it doesn't show a completed status of APP memory, which Xcode memory report did.
If you are using graphics rendering API, memory will increasing much faster than you thought. Size of OpenGL/Metal objects are created by graphics API in VRAM would count as APP memory using.
Many OpenGL instruction would copy data from RAM to VRAM for GPU consumption.
For example, if you create many texture and set image data to it. the heap allocation is much fewer than VARM allocation.
Remind MemoryWarning
will receive when using too much gross of RAM and VRAM.
Upvotes: 0
Reputation: 2199
Focus on the Live Bytes column for All Heap Allocations to see how much memory your application is using. You cannot control your application's Anonymous VM size.
Focus on the heap allocations because your app has more control over heap allocations. Most of the memory allocations your app makes are heap allocations.
The VM in anonymous VM stands for virtual memory. When your app launches, the operating system reserves a block of virtual memory for your application. This block is usually much larger than the amount of memory your app needs. When your app allocates memory, the operating system allocates the memory from the block it reserved.
Remember the second sentence in the previous paragraph. The operating system determines the size of the virtual memory block, not your app. That’s why you should focus on the heap allocations instead of anonymous VM. Your app has no control over the size of the anonymous VM.
Source: http://meandmark.com/blog/2014/01/instruments-heap-allocations-and-anonymous-vm/
Upvotes: 3