Re: Run garbage collection



Wojtek Bok <wb@xxxxxxxxxx> wrote:
I know I can request that the JVM run GC overall, but can
this be done on a particular object?


No. Because of the way garbage collection works, the virtual machine
would need to basically traverse the entire object graph anyway just to
determine if that object is referenced from any other live objects. If
that's the case, then you may as well free up all the other dead objects
at the same time. To do otherwise would be like spending all day
cooking a seven course meal, then eating a biscuit and throwing the
remainder in the trash.

--
Chris Smith
.