Note that there are some explanatory texts on larger screens.

plurals
  1. POJava memory as reported with JMX vs. htop
    primarykey
    data
    text
    <p>I'm trying to debug why a program which prints <code>Hello</code> and then <code>Thread.sleep(3600*1000)</code> uses ~404MB of virtual memory under linux (with both OpenJDK and Sun JVMs) on both CentOS 5 and Ubuntu 10.04 server. (a MediaTemple (dv) and (ve), respectively).</p> <p>But more specifically, when I connect using VisualVM or JConsole I see what looks like reasonable memory usage: 820KM heap (after GC); 8.4MB PermGen; 1136 classes loaded.</p> <p>Why the discrepancy? </p> <p>Is purely having a JVM running using that much memory? I tried starting two Hello apps to see if the memory usage scales linearly, and it does:</p> <p>I started with 78MB of total RAM used. Starting one hello app bumps the memory usage to 376MB. Starting another hello app gives a total RAM usage of 656MB, so memory doesn't seem to be shared well. (these numbers are not virtual memory </p> <p>(these specific numbers are with OpenJDK, but using the Sun 6 JDK gives comprable, but slightly lower memory usage)</p> <p>Code:</p> <pre><code>public class Hello { public static void main(String[] args) throws Throwable { System.out.println("HI"); Thread.sleep(3600 * 1000); return; } } </code></pre> <p>Command Line:</p> <pre><code>java -Xmx32m -Xms32m Hello </code></pre> <p>With JMX:</p> <pre><code> java -Dcom.sun.management.jmxremote.port=8005 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Xmx32m -Xms32m Hello </code></pre> <p>Thank you for your help,</p> <p>Wiktor</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload