RFR: 8275775: VM.metaspace prints flag 'f' for classes that have non-trivial finalize() [v3]

David Holmes david.holmes at oracle.com
Mon Nov 1 23:00:02 UTC 2021


On 2/11/2021 7:55 am, David Holmes wrote:
> On 1/11/2021 5:19 pm, Yi Yang wrote:
>> On Wed, 27 Oct 2021 01:30:37 GMT, Yi Yang <yyang at openjdk.org> wrote:
>>
>>>> Some customers want to observe which loaded classes have overridden 
>>>> the finalize() method. I found that VM.metaspace can output detailed 
>>>> classes. It seems feasible to add 'f' flag to it. With this patch, I 
>>>> found that ZipFileSystem left a finalize after applying this patch, 
>>>> which was obsolete 5 years ago, maybe we should remove it?
>>>
>>> Yi Yang has updated the pull request incrementally with one 
>>> additional commit since the last revision:
>>>
>>>    typo
>>
>> Hi David,
>>
>>> Do we have sufficient class information to combine with the 
>>> finalize() status, remembering that we will be reporting on every 
>>> single class, to make VM.classes worthwhile? Would a simple command 
>>> to list all non-trivially-finalizable classes be useful in itself? 
>>> VM.finalizable_classes?
>>
>> VM.finalizable_classes seems to be too ad-hoc. The only purpose is to 
>> print the class that has non-trivial finalize() method. If, maybe one 
>> day in the future, we want to know which classes have miranda method, 
>> we may need to add another VM.miranda_classes command. VM.classes can 
>> print detailed information of all loaded classes of the JVM, which 
>> looks more extensible and flexible.
> 
> My concern is there will be too much information to be useful if you 
> simply list and flag every single loaded class. We are basically trying 
> to make a decision whether to add a command that asks a specific query 
> (show me all finalizable classes), versus a command that just produces a 
> class dump and the user then has to manually apply their query to that 
> raw data. There are pros and cons to each approach.

It has been pointed out (thanks Alex) that we already have 
VM.class_hierarchy to print all classes, so perhaps that could be 
augmented to add a decorator for finalizable classes?

David

> This also seems more of a serviceability issue so I've cc'd that mailing 
> list.
> 
> Also this now relates to the new JEP on finalization removal:
> 
> https://openjdk.java.net/jeps/421
> 
> as a tool to help users see where finalizers exist will be useful to 
> that effort.
> 
> Cheers,
> David
> 
>> Thanks.
>>
>> -------------
>>
>> PR: https://git.openjdk.java.net/jdk/pull/6075
>>


More information about the serviceability-dev mailing list