Memory allocation: Difference between revisions

Line 365:
In Objeck space for local variables is allocated when a method/function is called and deallocated when a method/function exits. Objects and arrays are allocated from the heap and their memory is managed by the memory manager. The memory manager attempts to collect memory when an allocation threshold is met or exceeded. The memory manger uses a mark and sweep garbage collection algorithm.
<lang objeck>
foo := Object->New(); // allocates an object fromon the heap
foo_array := Int->New[size]; // allocates an integer array from the heap
x := 0; // allocates an integer fromon the runtime stack
</lang>
 
760

edits