Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding Instruments and the All Heap & Anonymous VM

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:

enter image description here

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?

like image 931
iOSTony Avatar asked Oct 29 '25 07:10

iOSTony


1 Answers

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/

like image 151
Utsav Dusad Avatar answered Nov 01 '25 12:11

Utsav Dusad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!