A problem on GC

  • Thread starter Thread starter Lei Jiang
  • Start date Start date
L

Lei Jiang

I have an ArrayList that contains 100 elements. Some of these elements are
referenced by other objects, but the ArrayList itself is not referenced by
any objects. Is the ArrayList could be GC'ed?

Thanks!
 
Lei Jiang said:
I have an ArrayList that contains 100 elements. Some of these elements are
referenced by other objects, but the ArrayList itself is not referenced by
any objects. Is the ArrayList could be GC'ed?

Yup.
 
If the ArrayList isn't referenced by anything, then it will indeed be GC'd
eventually.
 
Thank you all.

Stoitcho Goutsev (100) said:
Yes, it will eventually.

--
Stoitcho Goutsev (100) [C# MVP]


Lei Jiang said:
I have an ArrayList that contains 100 elements. Some of these elements are
referenced by other objects, but the ArrayList itself is not referenced by
any objects. Is the ArrayList could be GC'ed?

Thanks!
 
Back
Top