On Wed, 26 Aug 2026 13:31:57 GMT, Oli Gillespie <[email protected]> wrote:
> Please review this simple change to remove filler arrays (and objects) from > heap dumps. In the hprof format, they are not distinguishable from `int[]`, > which can be confusing (where are these huge `int[]`s coming from in my > application?), and they bloat the heap dump time and size. > > (Note: I sent a request for comments [on the serviceability-dev mailing > list](https://mail.openjdk.org/archives/list/[email protected]/thread/USL6YYR2UW76Z4VFESN225ZASLL2DHYQ/) > but got no response, so made a PR) > > Using Eclipse MAT, before: > > with-filler.hprof - 6.2GB > > Class Name | Objects | Shallow Heap > ===================================== > byte[] 39,938 4,997,553,360 > int[] 45,839 1,140,524,000 > > > After: > > without-filler.hprof - 5.0GB > > Class Name | Objects | Shallow Heap > ===================================== > byte[] 48,321 4,998,520,248 > int[] 4,995 951,088 > > > ([Test > file](https://gist.github.com/olivergillespie/1661499afb9e1c708de30cf0bdfca30e)) > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). Actually, there should be some differentiation; both jmap and heap dumping have options that select whether all or just live (actually: after attempted full gc) are included: ```jcmd <pid> GC.heap_dump options: -all: (Optional) Dump all objects, including unreachable objects (BOOLEAN, false) (https://docs.oracle.com/en/java/javase/26/docs/specs/man/jcmd.html) ```jmap -dump -dump:dump_options pid Connects to a running process and dumps the Java heap. The dump_options include: live --- When specified, dumps only the live objects; if not specified then dumps all objects in the heap. (https://docs.oracle.com/en/java/javase/26/docs/specs/man/jmap.html) (The defaults seem to be different :) ) So I'm not seeing skipping the fillers always an option unless the spec and functionality is changed. It is a bug that the current implementation does not skip them if requested (afair the code). Similar options/bugs exist for histogram printing. Not sure about how to best "dump" the filler arrays. Imo @shipilev 's argument about sensitivity of the information is valid, but it has already been accepted behavior. Heap dumps of any form always contain sensitive data, dumping unreachable data does not really change their sensitivity level. I do not think dumping unreachable data if requested is unreasonable. I have no good idea how to best integrate the fake [FillerElement; into HPROF's binary format. I do not think keeping them as int[] is that bad if a "full" heap dump is requested, objects, although it would certainly be nice to differentiate them. ------------- PR Comment: https://git.openjdk.org/jdk/pull/32542#issuecomment-5540531391
