Why Java is Not My Favorite Language — Reason #73

The garbage collector is not observable.

Every non-trivial application I have worked on, regardless of language, has had memory leaks. Even in garbage collected environments memory leaks happen. Given that, why would you design a GC’d language without providing observation hooks into the garbage collector? With Java your only, standard, option is ‘-verbose:gc’ which writes some information to the standard out. Not enough information, mind you, but some.

Unfortunately, I, and everyone else, use java on the server where standard out is useless. Repeat after me, there is no standard out. I could use -Xloggc to get that information logged to a file but that means the the file does not get rolled with the rest of my log files. And I still cannot do real time checking to see what my application is doing when the GC occurs. The whole thing is just so annoying when it could have easily been solved by allowing me to register a GC observer.

In the same vein thread dump writes to standard error. I know that this is really a VM issue rather than a Java language issue, apparently the IBM JVM does not have this damage, but it is caused by the same mistaken belief that standard out/error are usable.

Post a Comment

Your email is never published nor shared. Required fields are marked *