Discussions

Performance and scalability: Comparing java memory data from Linux top command and Profiler

  1. Problem: I am having a problem with possible memory leak, but that is not the main problem. The major problem is that when I am profiling the java process using jconsole (same outcome happens with YourKit) it does not seem like the java process is leaking memory. Both the heap and non-heap data shows that they are staying at a steady level (150MB and 225MB respectively). I did the performance capture before the problem got bad and when the system was low on memory. Then, when I look at the results from Linux top command, it shows a different story. It shows that the RES memory continues to grow (up to 1.2GB before crash), but this does not seem to match the data from the Profiler above that shows the non-heap not growing. Question: 1)I want to know if the RES results from the Linux top command should match or be close to the values for non-heap data found in the Java Profiler. 2-A) If they are supposed to match, what could be going on that would cause them to show such different values? OR 2-B) If they are not supposed to match, then how am I supposed to find out how the RES memory is growing if I can't use a Profiler? Thanks
  2. Dear Eduardo, The most important thing that is stored outside the heap and non-heap are the native stacks for threads. If you have a large number of threads, the room you need for those can be considerable. Here is a discussion on how memory is laid out. http://java-monitor.com/forum/showthread.php?t=570 Kees Jan PS. Not sure if this helps, but here is a question on Java-monitor that may be related. A user asks to explain differences in top and from Java. http://java-monitor.com/forum/showthread.php?t=471