Skip to content

SapMachine #2250: Add adjustments to heap dumps for the buildpack#2251

Open
schmelter-sap wants to merge 15 commits into
SAP:sapmachinefrom
schmelter-sap:heapdump-adjustments-for-buildpack
Open

SapMachine #2250: Add adjustments to heap dumps for the buildpack#2251
schmelter-sap wants to merge 15 commits into
SAP:sapmachinefrom
schmelter-sap:heapdump-adjustments-for-buildpack

Conversation

@schmelter-sap

@schmelter-sap schmelter-sap commented May 19, 2026

Copy link
Copy Markdown
Member

This change adds features to the heap dump for the cf buildpack to be able to store heap dumps for customers in the object store. It includes the following features:

  • Added -XX:+HeapDumpOverwrite flag. This allows a heap dump to overwrite an existing file. It is also need to write to a named pipe. The latter will be used by the buildpack to stream from the named pipe to the object store. You could already do this in the jcmd GC.heap_dump command.
  • Added -XX:HeapDumpParallelism=<nr-of-threads> flag. This allows to specify the number of threads to use when writing the heap dump. You could already do this in the jcmd GC.heap_dump command.
  • When using only one thread to dump the heap, the code will use additional files apart from the heap dump file. This ensures that no extra disk space is used when using only one thread.
  • Added -XX:+LimitPrimArrayContentInHeapDump flag. If enabled, the heap dump will only write the real content for the first elements of large primitive arrays. The rest is filled with 0 (or false for boolean arrays). This makes the heap dump much more compressible, making upload to the object store faster. The number of entries to keep can be set via -XX:StringLikeContentSizeLimitInHeapDump=<limit> for byte and char arrays (default is 120) or -XX:ArrayContentSizeLimitInHeapDump=<limit> for the other primitive arrays (default is 50).

fixes #2250

@schmelter-sap schmelter-sap requested a review from MBaesken May 20, 2026 08:48
@SapMachine

Copy link
Copy Markdown
Member

Hello @schmelter-sap, this pull request fulfills all formal requirements.

@schmelter-sap schmelter-sap requested a review from RealCLanger May 20, 2026 08:49
@MBaesken

Copy link
Copy Markdown
Member

Couple of minor adjustments might be needed in globals.hpp
"the content of primitive arrays in not completely" should be "is not"
"this only really safes space" should be "saves"
In StringLikeContentSizeLimitInHeapDump description - "primitive char and bytes arrays" should be "byte"

Comment thread src/hotspot/share/services/heapDumper.cpp
Comment thread src/hotspot/share/runtime/globals.hpp
Comment thread test/hotspot/jtreg/serviceability/HeapDump/PartialArrayContentTest.java Outdated
@SapMachine

Copy link
Copy Markdown
Member

Hello @schmelter-sap, this pull request fulfills all formal requirements.

Comment thread src/hotspot/share/runtime/globals.hpp Outdated
Comment thread src/hotspot/share/runtime/globals.hpp Outdated
Comment thread src/hotspot/share/services/heapDumper.cpp Outdated
Comment thread src/hotspot/share/services/heapDumper.cpp
Comment thread test/hotspot/jtreg/serviceability/HeapDump/PartialArrayContentTest.java Outdated
Comment thread src/hotspot/share/services/heapDumper.cpp Outdated
@SapMachine

Copy link
Copy Markdown
Member

Hello @schmelter-sap, this pull request fulfills all formal requirements.

@SapMachine

Copy link
Copy Markdown
Member

Hello @schmelter-sap, this pull request fulfills all formal requirements.

@SapMachine

Copy link
Copy Markdown
Member

Hello @schmelter-sap, this pull request fulfills all formal requirements.

@SapMachine

Copy link
Copy Markdown
Member

Hello @schmelter-sap, this pull request fulfills all formal requirements.

@dbriemann dbriemann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small change needed.

Comment thread test/hotspot/jtreg/serviceability/HeapDump/PartialArrayContentTest.java Outdated
@SapMachine

Copy link
Copy Markdown
Member

Hello @schmelter-sap, this pull request fulfills all formal requirements.

@dbriemann dbriemann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@RealCLanger RealCLanger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one minor spelling nit.

And a more general question: Don't you think this could be something to contribute to the OpenJDK? Like "space efficient generation of heap dumps" or such?

DumpWriter segment_writer(DumpMerger::get_writer_path(writer()->get_file_path(), dumper_id),
writer()->is_overwrite(), writer()->compressor());
// SapMachine 2026-05-06: Don't use segments if the dump is not parallel. This makes it
// possible to not use any disk space if dumping to a names pipe or a tty.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// possible to not use any disk space if dumping to a names pipe or a tty.
// possible to not use any disk space if dumping to a named pipe or a tty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add adjustments to heap dumps for the buildpack

5 participants