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

Staffan Larsen staffan.larsen at oracle.com
Tue May 5 10:38:37 UTC 2015


I think this should be reviewed on hotspot-gc and core-libs-dev as well considering the changes to Finalizer.

I’m a little worried about the potentially very large String that is returned from printFinalizationQueue(). A possible different approach would be to write printFinalizationQueue() in C++ inside Hotspot. That would allow for outputting one line at a time. The output would still be saved in memory (since the stream is buffered), but at least the data is only saved once in memory, then. It would make the code a bit harder to write, so its a question of how scared we are of running out of memory.

I see you are traversing the ‘unfinalized’ list in Finalizer, whereas the old SA code for ‘-finalizerinfo' traverses the ‘queue’ list. I am not sure of the difference, perhaps someone from the GC team can help out?

For the output, it would be a nice touch to sort it on the number of references for each type. Perhaps outputting it more like a table (see the old code again) would also make it easier to digest.

In diagnosticCommand.hpp, the new commands should override permission() and limit access:

  static const JavaPermission permission() {
    JavaPermission p = {"java.lang.management.ManagementPermission",
                        "monitor", NULL};
    return p;

The two tests don’t validate the output in any way. Would it be possible to add validation? Perhaps hard to make sure an object is on the finalizer queue… Hmm.


> On 5 maj 2015, at 12:01, Dmitry Samersoff <dmitry.samersoff at oracle.com> wrote:
> Everyone,
> Please review the fix:
> http://cr.openjdk.java.net/~dsamersoff/JDK-8059036/webrev.01/
> heap dcmd outputs the same information as SIGBREAK
> finalizerinfo dcmd outputs a list of all classes in finalization queue
> with count
> -Dmitry
> -- 
> Dmitry Samersoff
> Oracle Java development team, Saint Petersburg, Russia
> * I would love to change the world, but they won't give me the sources.

More information about the core-libs-dev mailing list