In Java, how is an Array of objects garbage collected? -
when array of objects not referenced anymore, objects in array garbage collected too? (assuming no variables referencing elements)
in page, http://java.sys-con.com/node/37613 says - "the biggest danger placing object collection , forgetting remove it. memory used object never reclaimed."
if make sure nullify references, why memory unclaimed?
thanks
when array of objects not referenced anymore, objects in array garbage collected too? (assuming no variables referencing elements)
yes.
"the biggest danger placing object collection , forgetting remove it. memory used object never reclaimed."
this when are holding reference collection. example, if have map
in put key-value , forget remove stays there ever. think http sessions, if use in servercontext
or such @ start of request using session id key fail remove @ end of request processing..
Comments
Post a Comment