Nulling Out References Won't Help Your Garbage Collector

One of the misconceptions that I continuously run into is that nulling out references in Java helps garbage collection. This attitude is particularly prevalent from those developers used to C/C++ where delete ptr becomes ref = null . To be fair, it’s a reasonable thing to believe. It’s also wrong, and the way it’s wrong tells you most of what’s worth knowing about how a tracing collector actually…