December 2001
Intermediate to advanced
416 pages
8h 16m
English
We do not explicitly delete objects allocated through the new expression. Rather, these objects are cleaned up by garbage collection in the runtime environment. The garbage collection algorithm recognizes when an object on the managed heap is no longer referenced. That object is marked as available for collection.
When we allocate a reference type on the managed heap, such as the following array object:
int [] fib =
new int[6]{ 1,1,2,3,5,8 };
the heap object is recognized as having an active reference. In this example, the array object is referred to by fib.
Now let's initialize a second array handle with the object referred to by fib:
int [] notfib = fib;
The result is a shallow copy. Rather than notfib addressing ...
Read now
Unlock full access