RFR: 8275775: VM.metaspace prints flag 'f' for classes that have non-trivial finalize() [v3]
Thomas Stuefe
stuefe at openjdk.java.net
Wed Oct 27 04:44:10 UTC 2021
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 Yi,
I'm ambivalent because `VM.metaspace` is not a particularly good place for that info. `VM.metaspace` prints info related to the memory usage of metadata. `s` fits there because shared classes are not stored in Metaspace, which is a vital info when looking at the output (the numbers won't make sense otherwise). But the new `f` is just some arbitrary information about the class makeup with no particular influence on metaspace.
OTOH I don't know any other existing command better suited. We have GC.class_histogram, VM.class_hierarchy and VM.classloaders (also with `show-classes` option), all print out classes. But the same problem there, why add it there.
Are you sure VM.metaspace is what you want? I won't block this patch, if you are sure. But if we do this we should longterm find a better command for this info, or add a new command (`VM.class_details` or whatever).
---
A regression test is needed for this. Please adapt `runtime/Metaspace/PrintMetaspaceDcmd.java`:
- add a test to test `show-classes` (we already test `show-loaders` so maybe you can piggyback on that one
- test for a class you know has a non-trivial finalize to show up with `f`, and for one which has not to not show `f`
- optionally, add `@run` configuration to run at least once with `-Xshare:off` to test how the output looks like when applied to a VM without CDS (so, no `s` should be printed, but your new `f` output should still show up)
Thank you,
Thomas
-------------
Changes requested by stuefe (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/6075
More information about the hotspot-runtime-dev
mailing list