12 points · by abarrera · 19y ago · 18 comments
No, the title is misleading. It was misleading on reddit too.
> ... because I can't manually destroy objects.
I'm not sure about Java, but if it's similar to C# then you can manually destroy objects. When they get "officially" removed from memory is up to the garbage collector (that is, when more memory space is needed).
Why might someone need that level of control? Well in an ideal world you would not, but in reality (at least in Java), GC is highly JVM dependent, and on the JVM I use (and probably most if not all of them) GC makes no guarantee that objects available for collection will actually be collected. The OS X JVM in particular is pretty bad here (again, I'm guessing others are too), when you run out of memory, it doesn't even try to GC. Even if you call System.gc() you might not get any space reclaimed. Its ridiculous, but lots of people actually have a method that is basically "System.reallyGC()" which loops a whole bunch of times on System.gc() calls until it either gives up or reclaims some percentage of memory.
That explains it. From a site that uses a photoshop of Bill Gates/Borg hybrid for every Microsoft story, it's no wonder the title's misleading.