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). This pull request has now been integrated. Changeset: 392696e2 Author: Oli Gillespie <[email protected]> Committer: David Holmes <[email protected]> URL: https://git.openjdk.org/jdk/commit/392696e274e333fd0f74d2f0a23c2a902f45ae70 Stats: 10 lines in 1 file changed: 7 ins; 0 del; 3 mod 8392345: Omit filler objects in 'live' heap dump Reviewed-by: shade, ayang, tschatzl ------------- PR: https://git.openjdk.org/jdk/pull/32860
