Mustang is now packaged with Java DB. So, we have a database included in Mustang (Java SE 6). I am excited because...
Many of you would know jmap can dump snapshot of Java heap (of a live process or a java core dump) into a binary format file. Or alternatively hprof
profiler may also be used to dump heap snapshot.
The heap snapshot binary format (a.k.a hprof binary format) is described at
And you may already know that jhat (Java Heap Analysis Tool) can be used to analyze the heap dumps produced by jmap and hprof. jhat supports OQL (a SQL-like language) to query the heap.
Essential idea of jhat/OQL is this: heap snapshot is a database of objects. jhat parses the dump, creates in-memory object model, interprets query and generates result HTML.
How about this? - a new command line utility to "import" heap dump files into a database like Java DB. Then, we can use SQL to query the database - and it would be very easy to write tools on top of JDBC/SQL access. Besides, we can take advantage of the "large file" handling, indexing, query optimization aspects of the database - rather than having to implement similar stuff by jhat. Or may be, we can reimplement jhat as a tool that
Yes that might be a possibility. Also the question would be, whether it would be fast enough for large heaps. I've seen heaps with millions of objects.
By the way the heap dump feature is now also available for JDK 1.4 and 1.5 See my blog at https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/u/6389
Regards,
Markus