Does variable = null set it for garbage collection

Posted by manyxcxi on Stack Overflow See other posts from Stack Overflow or by manyxcxi
Published on 2010-05-28T17:28:28Z Indexed on 2010/05/28 17:31 UTC
Read the original article Hit count: 232

Help me settle a dispute with a coworker: Does setting a variable or collection to null in Java aid in garbage collection and reducing memory usage? If I have a long running program and each function may be iteratively called (potentially thousands of times): Does setting all the variables in it to null before returning a value to the parent function help reduce heap size/memory usage?

© Stack Overflow or respective owner

Related posts about java

Related posts about Performance