Fully featured low overhead profiler for Java EE and Java SE platforms.
Ultimate profiling and monitoring solution for Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

Allocated memory vs. used memory

Moderators: Vladimir Kondratyev, Anton Katilin

Allocated memory vs. used memory

Postby runestilling » Tue May 23, 2017 8:15 pm

Hi forum

I'm using YourKit to analyze a Tomcat Web application that seems to leak memory over time. But I'm not quite sure weather it's a leak or something else.

Memory shown for the process in the Windows Task Manager keeps growing. Looking at the process in YourKit tells a different story. In YourKit "all pools" also keeps growing but the rest om the different types seem constant (after GC). Also if make two memory snapshots they show no leaked objects.

Image

Thx,
Rune
runestilling
 
Posts: 3
Joined: Tue May 23, 2017 8:06 pm

Re: Allocated memory vs. used memory

Postby runestilling » Wed May 24, 2017 4:58 am

PS. For some reason the entire image doesn't show. Here's a link: http://rdfined.fastmail.fm/diverse/yourkit.png

PPS. I guess some of the answer lies in this post's reply:

viewtopic.php?f=3&t=3903
https://stackoverflow.com/questions/126 ... ol-divided

But even after many hours of idling the allocated memory isn't released:

http://rdfined.fastmail.fm/diverse/yourkit2.png
runestilling
 
Posts: 3
Joined: Tue May 23, 2017 8:06 pm

Re: Allocated memory vs. used memory

Postby Anton Katilin » Wed May 24, 2017 10:05 am

Hello Rune

If you don't see any leaked objects between snapshots then you don't have any Java-side leaks, i.e. leaks in the Java heap.

However, a JVM process uses memory outside the Java heap too, for its internal structures. Perhaps this is how Java manages its memory allocation.

Is the observed memory growth infinite? For how long does the JVM process run?

Also, a leak may be caused by a native library allocating memory outside the heap. Do you know whether your application uses any?

Please also note that you monitor physical memory in Windows Task Manager. Switch to "Details" tab and make "Commit size" column which corresponds to virtual memory visible (right click the table title and select columns). Do you see that virtual memory grows as well?

Best regards,
Anton
Anton Katilin
 
Posts: 5576
Joined: Wed Aug 11, 2004 8:37 am

Re: Allocated memory vs. used memory

Postby runestilling » Mon May 29, 2017 10:07 am

Hi Anton

Thank you for the reply. As far as I can tell from the yourkit memory graphs the both heap and non heap memory usage is constant:

http://rdfined.fastmail.fm/diverse/YourKit3.png
http://rdfined.fastmail.fm/diverse/YourKit4.png

But the numbers don't add up. The task manager still shows a higher memory usage (and growing).

My application shouldn't use any native libraries as far as I know (it's a web application running in a Tomcat 8.5 container).

The memory continues to grow.

/Rune
runestilling
 
Posts: 3
Joined: Tue May 23, 2017 8:06 pm

Re: Allocated memory vs. used memory

Postby Anton Katilin » Mon May 29, 2017 12:07 pm

Hi Rune

Task Manager shows total process memory usage. Java heap and non-heap are only part of it.
If the process memory grows but heaps don't, something happens outside the heaps. This may be JVMs memory usage, native library memory usage or even agent's memory usage.

Is the observed memory growth infinite? For how long does the JVM process run?

Anyway, could you please provide:
1. The profiler agent log file ~/.yjp/log/<session name>-<pid>.log
2. A performance snapshot of the application (.snapshot file).

You may zip them and send attached to support@yourkit.com

Best regards,
Anton
Anton Katilin
 
Posts: 5576
Joined: Wed Aug 11, 2004 8:37 am


Return to Java Profiler

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 7 guests