On Thu, 3 Sep 2026 14:14:11 GMT, Oli Gillespie <[email protected]> wrote:

> (See also https://bugs.openjdk.org/browse/JDK-8372389, which proposed to omit 
> these entirely)
> 
> Heap filler arrays are stored internally as int typearrays, and currently 
> dumped as `int[]` in heap dumps. This is confusing for users, as these filler 
> arrays are not distinguishable from real user int arrays.
> 
> To distinguish them, dump them as `FillerElement[]` instead with null 
> elements.
> 
> This also removes the security issue of dumping random heap data in filler 
> arrays.
> 
> Implementation note: I have kept the length of the emitted object array the 
> same as the underlying type array. That means the array lengths in the dump 
> will be 'correct', but tools like MAT which estimate the array footprint 
> based on heap size/compressed oops enablement will estimate double the true 
> size for JVMs with uncompressed oops (`int[100]`, 400 bytes of data, becomes 
> `FillerElement[100]`, 800 estimated bytes of data). We *could* instead adjust 
> the length to give a better size estimate, if desired.
> 
> Using Eclipse MAT, before:
> 
> before.hprof - 2.6GB
> 
> Class Name | Objects | Shallow Heap
> =====================================
>      int[]    5,542     1.40GB
> 
> 
> After:
> 
> after.hprof - 3.7GB
> 
> Class Name                     | Objects | Shallow Heap
> ============================================================
> jdk.internal.vm.FillerElement[]        69   1.10GB
>                           int[]     5,482   1.50MB
> 
> 
> Performance seems to be similar, but dumps with lots of filler elements are 
> bigger because elements take 8 bytes instead of 4. Very compressible, though.
> 
> ---------
> - [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 been closed without being integrated.

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

PR: https://git.openjdk.org/jdk/pull/32687

Reply via email to