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

Exposing simple UI action to open next segment of a heap dump #3518

Merged

Conversation

JaroslavTulach
Copy link

@JaroslavTulach JaroslavTulach commented Jan 27, 2022

I've created a simple library to generate .hprof files: HeapDump. It follows the Java Profiler Heap Dump Format specification, however it allows more than regular JVMs do. Regular JVMs always dump the whole heap in a single round, while the HeapDump allows one to generate multiple segments.

There already is support for reading these multisegment files in the Apache NetBeans Profiler library - it just isn't exposed in the heapwalker UI. This PR fixes that. The fix isn't "fancy", but it does its job. When an additional segment is detected, there is a little link in the UI to open it in a new window.

obrazek

Simple, but functional. I'd be delighted if the support for multisegment .hprof files landed in the NetBeans 13.

@@ -28,16 +28,19 @@
*/
class CacheDirectory {

private static final String DIR_EXT = ".hwcache"; // NOI18N
private static final String DIR_EXT = ".nbcache"; // NOI18N
Copy link
Author

Choose a reason for hiding this comment

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

This change is useful to avoid clash between Apache NetBeans profiler library and VisualVM profiler library. Both of these libraries are derived from NetBeans 8.2 profiler library, but evolve independently. Sharing the same directory leads to errors like:

java.io.IOException: Invalid HPROF version 3 loaded 2
        at ...HprofHeap.<init>(HprofHeap.java)
        at ...HeapFactory.loadHeap(HeapFactory.java)
        at ...HeapFactory.createHeap(HeapFactory.java)

Copy link
Member

@neilcsmith-net neilcsmith-net left a comment

Choose a reason for hiding this comment

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

Fine with me. Feel free to merge when review complete as long as before next Tues.

Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

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

Looks ok to me.

@JaroslavTulach
Copy link
Author

The Profiler native binary build-windows is repeatedly failing. Do you think it can be because of my changes? I have renamed the cached directory - that is the only (yet unlikely) thing which could cause the profiler binaries failures.

@neilcsmith-net
Copy link
Member

neilcsmith-net commented Jan 28, 2022

Looks like it might have been failing for a while. It's only triggered rarely by path. Just done a manual trigger on master.

And fails there too https://github.com/apache/netbeans/actions/runs/1762385602

@JaroslavTulach JaroslavTulach merged commit 80879f8 into apache:delivery Jan 28, 2022
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.

3 participants