function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

When is heap allocated ?

Heap allocation means allocation of memory to some component, be it a class, method or variable.


I was trying to understand the WHEN of heap allocation, by reading debug log.


In debug log, the heap is allocated to a variable, before the call to the method in which it is declared. And also the scope of variable begins before the execution of the method begins. I haven't used any access modifier with the variable declaration. So, the varibale must be private.


Then how the variable has been alloacted the heap and it's scope has begun, before the method execution ?