On 2015-05-21 02:07, Mandy Chung wrote:
> 
>> On May 19, 2015, at 11:51 PM, Dmitry Samersoff
>> <dmitry.samers...@oracle.com <mailto:dmitry.samers...@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.  

done.

> 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

One of previous versions count total a number of instances registered
for finalization but then we decided that number of unreachable
instances awaiting finalization has more value for customer.

> 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.

Current implementation is lock-free and don't stop the world, we decided
to make it less expensive at the cost of less accurate results.

-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.

Reply via email to