On Mon, 14 Sep 2026 13:42:00 GMT, Oli Gillespie <[email protected]> wrote:

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

A minor naming suggestion.

src/hotspot/share/services/heapDumper.cpp line 2183:

> 2181:   UnmountedVThreadDumper* _vthread_dumper;
> 2182:   FlatObjectDumper* _flat_dumper;
> 2183:   bool _skip_filler_objects;

Maybe `_should_skip_fillers`?

-------------

Marked as reviewed by ayang (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/32860#pullrequestreview-5229661688
PR Review Comment: https://git.openjdk.org/jdk/pull/32860#discussion_r4031921952

Reply via email to