Hi,
in continuation to this topic, i would like to ask, how does the GC come to know about which object to garbage collect ?
Let me clarify my question
say if you create an ArrayList to hold say 1000 elements.
you assign proper values to all of them, means they consume memory.
now you assign the reference to some other object. so now there is no reference pointing to the previous ArrayList.
So how does the GC come to know about the previous 1000 element memory?
Is this not a memory leak ?
Or is it like that all the memory used by the
Java program is freed at time of termination?
Please guide
Thanks in advance..