This you can do. The garbage collector runs in a separate thread from the thread of execution, reclaiming space here and there when it finds objects that can no longer be referenced, or other unreachable code.
The garbage collector has been around the block. She's seen objects come and go, every day throughout the years. And she's not about to take any lip from some upstart crow telling her how to manage her memory.
To suggest that the garbage collector run, which does not guarantee that it runs, try tempting her with this:
Note that, like other methods in the System class, this is the effective equivalent of calling
This means that the Java Virtual Machine ...