Search code examples
javaprofilingrmivisualvm

VisualVM profiling is polluting results


I am using VisualVM memory profiling to analyse the memory allocation behavior of an application. Unfortunately, it seems the profiling process itself is polluting my results.

I continually see 80Mb being allocated over the timeframe of 5 minutes, which is due to memory profiling results being serialised over the JMXBean RMI connection. This memory is always in generation 1 and is immediately GC'd when I ask for it, but it is still annoying that this is showing up.

Can I filter memory profiling results based on the class that did the allocation?


Solution

  • Try JProfiler, it does not use heap resources. You can see here:

    Why does an empty Java program consume memory?

    that visualvm even allocates lots of stuff when profiling an empty application.