java - Can nulling a method variable make it garbage collectable? -
this question has reply here:
does setting java objects null anymore? 4 answersbackground: have method bunch of fiddling copies of giant list
s , running our of memory. of in single method scope.
question: luckily need original giant list @ origin of method. in method, setting list null
allow garbage collecting it? or jit or compiler automatically dereference variable sees no longer used? i'm thinking minor optimization allow before garbage collection.
there no need nullify variable. article on garbage collection (that worth read) can found here. looking section labeled "explicit nulling"
java garbage-collection jvm
No comments:
Post a Comment