RFR(M, v7): JDK-8059036 : Implement Diagnostic Commands for heap and finalizerinfo

Mandy Chung mandy.chung at oracle.com
Wed May 20 23:07:21 UTC 2015

> On May 19, 2015, at 11:51 PM, Dmitry Samersoff <dmitry.samersoff at oracle.com> wrote:
> Other alternatives could be to do all hashing/sorting/printing on native
> layer i.e. implement printFinalizationQueue inside VM.
> Both options has pros and cons - Java based solution requires less JNI
> calls and better readable but takes more memory.
> It might be better to return an array of Map.Entry<String, int[]>
> objects to VM rather than one huge string.

The output and formatting should be done by jcmd.  What you really need to get a peek on the finalizer queue and print the histogram.   The VM has the heap histogram implementation.  Have you considered leveraging that? 

   5:          1012          40480  java.lang.ref.Finalizer

You can find the registered Finalizer instances.  The downside is that icmd -finalizerinfo stops the world.  I think it’s not unreasonable for this diagnostic command to be expensive like -heap command.


More information about the core-libs-dev mailing list