On Sun, Nov 23, 2008 at 5:02 PM, Sam S E <[EMAIL PROTECTED]> wrote: > What is allocated in the gc heap? Just classes? Dynamic/associative arrays? > Structs? Only things allocated with new? Do built-in types and structs get > deallocated at the end of scope like in C? >
Everything that is a reference type (classes, dynamic arrays, AAs) is allocated on the heap. Everything that is a value type (basic types, fixed-size arrays, structs) are allocated on the stack and are deallocated when the scope is left. scope references to classes will delete the class they refer to when the scope is left. As a special case, a declaration of the form "scope x = new ClassType()" will actually allocate the class instance on the stack instead of on the heap.