The release of Java 6 is getting closer now. Java 6 does not seem to get near that much attention as Java 5 did before it was released. This is probably because Java 5 contained several new language features and Java 6 doesn’t, and Java 6 is released within a shorter interval. To lots of Java programmers version 5 is still “new” because they are working on an older version. Java 6 does come with a lot of interesting improvements, such as improved performance, lots of desktop improvements and library enhancements though. Maybe next year these programmers will get to skip a number and catch up. I know it’s probably wishful thinking but maybe there is still hope. 🙂
The Sun JVM also got a tune-up in the management and monitoring area, which was about time, because it lagged behind compared to innovations in the IBM and BEA JVMs. Sun certainly raised the bar quite a bit though. See this article at java.sun.com for a complete overview of the new stuff. Features like JMX and DTrace on Solaris are now enabled by default, instead of requiring command line flags at start-up. In addition Java 6 includes some monitoring tools on Windows that previously were only available on Linux and Solaris. One of these tools is JMap, which is a very handy and lightweight tool to inspect the heap of a running Java VM without using a profiler.
And finally, a feature that is in IBM JVMs for years has arrived in Suns as well: -XX:+HeapDumpOnOutOfMemoryError! This is a JVM argument that well, when enabled, writes a heap dump to a file when an OutOfMemoryError occurs! This is very useful for post-mortem debugging those nasty leaks that only happen once a while, only on the production servers. Note that this JVM flag has been backported to Java 5 and 1.4.2 as well, in the latest updates.
In order to analyze the heapdumps generated by the JVM using JMap, the JVM flag or some other method, a new tool is provided as well: JHat. I played a bit with JHat but this tool seems to require quite a bit of memory to analyze a big heap. Another tool which understands the dumps is the IBM HeapAnalyzer tool. Although a bit less powerful than JHat, it is a lot more intuitive and requires less memory, handles both Sun and IBM dumps, and has some neat options such as “Find leak suspects”, that do a pretty good job at analyzing memory problems fast and easy.
Some of the improvements to Java 6 management and monitoring are further “under the hood”, and will require tooling to adapt to use the new features. The first Eclipse 3.3 milestone (yes, it is already out there), contains a new debugging option that allows you to find the objects that refer to a specific object. It will be interesting to see more of these powerful and useful new tools to manage and monitor the Java 6 JVM.
One comment
The part about the XX:+HeapDumpOnOutOfMemoryError being backported to revision 14 of 1.4.2 is very interisting news to me. My current project occasionally has random out of memory errors. At this moment the only thing being done is increasing the heap size. Which probably only delays the inevitable.
Good stuff indeed.
Jeroen Leenarts