Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-10518] Native Image heap dumps are polluted by objects created during heap dump creation #4637

Closed
fniephaus opened this issue Jun 10, 2022 · 2 comments · Fixed by #6135
Closed

Comments

@fniephaus
Copy link
Member

When dumping the heap of a native executable to analyze it in VisualVM, the heap dump is polluted by objects that are created during the heap dump creation.

This makes it hard to analyze smaller heap dumps, especially initial heaps obtained through -XX:+DumpHeapAndExit, as they are often dominated by the objects created during heap dump creation. Here's an example screenshot of a heap dump for a native HelloWorld:
Screenshot from 2022-06-10 14-45-41

The heap dump pollution can be avoided by using only unmanaged, native memory within the heap dump writer rather than managed, heap-allocated objects.

@fniephaus
Copy link
Member Author

It seems that the heap dump writer also allocates numerous strings and other objects. Most notably, it seems to allocate 5700+ strings with a value of utf-8:

image

@SergejIsbrecht
Copy link

How about writing out the metadeta (HeapdumpWriterImpl) needed to write the hprof file to an extra file during generation, later on, when an dump should happen, the file will be mapped into memory and used to write the hprof file.

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

Successfully merging a pull request may close this issue.

3 participants