oracle / visualvm

VisualVM is an All-in-One Java Troubleshooting Tool
https://visualvm.github.io/
Other
2.89k stars 306 forks source link

Hide Memory Profiler results based on class in allocation stacktrace? #161

Open void256 opened 5 years ago

void256 commented 5 years ago

I'm profiling memory and I'm not restricting classes in the Memory settings tab so that I can find allocations of all possible classes (Profile classes contains "*").

This works pretty good and I find f.i. "java.lang.Float" instances that I do actually create in my program (my classes are showing up in the allocation stack trace).

However, there are entries showing up that don't belong to any of my classes and which I suspect are maybe a side effect of the profiling itself, f.i javax.managment.openmbean.CompositeDataSupport or some java.io.ObjectOutputStream:

unwanted-allocation-stacktrace

Is there a way to somehow hide results like that? What is the origin of these allocations?

Thanks!

EDIT: If I don't limit the allocation stacktrace I can trace these back to some RMI/TCP connection that I suspect is maybe part of how jVisualVM gets its data from the process it profiles?

unlimited
thurka commented 5 years ago

CompositeDataSupport and ObjectOutputStream are used by JMX monitoring. This is used for example for CPU load and Thread state monitoring. JMX is not used for profiling.

void256 commented 5 years ago

Thanks a lot for the clarification @thurka!

This was actually a very helpful hint because I can now add -Dsun.rmi.transport.tcp.maxConnectionThreads=0 to my application to force JMX monitoring off and all of the related entries are gone from the memory profile result tab 😄 This makes analyzing the output much more easy.

Well, having an option in VisualVM to turn JMX based monitoring off would make this a bit more accessible. Would this be possible?

pravinps27 commented 4 months ago

Screenshot 2024-07-23 235519 I am using the Visual VM to profiling the memory as same as you did but unexpectedly I the memory tab doesn't show any live objects and its memory but the CPU tab show live object as per method wise correctly. Can you suggest me to do any other configuration at the plugin level or Eclipse IDE's argument level if needed?