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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top