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

Mandy Chung mandy.chung at oracle.com
Wed May 27 13:32:38 UTC 2015


> On May 27, 2015, at 12:34 AM, Peter Levart <peter.levart at gmail.com> wrote:
> 
> Hi Dmitry,
> 
> The jdk part looks OK (no great changes on this side from last webrev). Is there a particular reason why the return type of printFinalizayionQueue() method is Object[] and not Map.Entry<String, int[]>[] ?
> 

Taking it further - is it simpler to return String[] of all classnames including the duplicated ones and have the VM do the count?  Are you concerned with the size of the String[]?

> For the hotspot part, I have a few reservations. You expect that the type of array elements will be HashMap.Node and that the key/value fields will be at fixed offsets. Is this even true for all architectures (32bit, 64bit +-UseCompressedOops)?
> 
> The type of HashMap entry is controlled by code in HashMap which has a long history of changes. Next time the implementation of HashMap changes, your code could break. Would it be possible to only use public API? To invoke methods on Map.Entry interface to obtain the key and value?
> 

Indeed, depending on the HashMap internal implementation is a bad idea.

Mandy

> Regards, Peter
> 
> On 05/26/2015 04:16 PM, Dmitry Samersoff wrote:
>> Hi Everybody,
>> 
>> http://cr.openjdk.java.net/~dsamersoff/JDK-8059036/webrev.09/
>> 
>> Please review updated webrev -
>> 
>> printFinalizationQueue now returns and array of Map.Entry<String, int[])
>> and all formatting is done on VM side.
>> 
>> -Dmitry
>> 
>> On 2015-05-21 02:07, Mandy Chung wrote:
>>>> On May 19, 2015, at 11:51 PM, Dmitry Samersoff
>>>> <dmitry.samersoff at oracle.com <mailto: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.
>>> 
>>> Mandy
>> 
> 



More information about the serviceability-dev mailing list