> Heap dumps offer the ability to exclude unreachable objects, but they > actually still include GC filler objects/arrays (see > https://tschatzl.github.io/2022/09/26/jdk-vm-internal-fillerarray.html for > more on fillers). > > If the user requests to exclude unreachable objects/include only live > objects, heap dump triggers a full GC before dumping, so in theory only live > objects remain. But filler objects can 'survive' a full GC even though they > are unreachable by definition. They waste space, and cause confusion. If > using a tool like MAT, they will show as unreachable - why are unreachable > objects in my live heap dump? If using something like JOL to show a > histogram, reachability is not assessed and the user may not notice that > unreachable objects are influencing the results. They show as `int[]`, so > their provenance is not obvious. > > So, exclude them explicitly if the user requested only live objects. This > does not affect non-live dumps (discussion for that in > [JDK-8372389](https://bugs.openjdk.org/browse/JDK-8372389)). > > > $ ls -lah > 1.5G Sep 14 13:30 live-after-fix.hprof > 2.6G Sep 14 13:30 live-before-fix.hprof > > $ java -jar jol-cli.jar heapdump-stats live-before-fix.hprof > > INSTANCES SIZE SUM SIZE CLASS > ------------------------------------------------------------------------------------------------ > 5 236,870,896 1,184,354,480 int[59217720] <--- > filler arrays! > > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai).
Oli Gillespie has updated the pull request incrementally with two additional commits since the last revision: - Revert "Rename skip_filler_objects -> should_skip_filler" This reverts commit ad572794d548c2d6154d80640d01f14b1941a4e8. - Rename skip_filler_objects -> should_skip_filler ------------- Changes: - all: https://git.openjdk.org/jdk/pull/32860/files - new: https://git.openjdk.org/jdk/pull/32860/files/6091448d..0e6d3ef8 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=32860&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=32860&range=00-01 Stats: 0 lines in 0 files changed: 0 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/32860.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/32860/head:pull/32860 PR: https://git.openjdk.org/jdk/pull/32860
