1
votes

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?

2

2 Answers

3
votes

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.

1
votes

I have found the same problem. For this reason I use a commercial profiler, such as YourKit, which uses a native agent for its profiling and doesn't use the heap or have much overhead.