Understanding memory usage
Understanding a Rich Client Platform (RCP) application's total memory usage can be a tricky affair. The operating system (OS) tells you how much memory your application consumes, and the Java™ platform tells you how much heap you've consumed. The memory usage that the OS reports is always greater than the available heap size. Unfortunately, sometimes the number that the OS reports is much larger than the heap size. One of the challenges of heap analysis is determining what lies in this "dark space."
In general: process memory usage = Java heap + complied native code + bytecodes + other / native
Unfortunately, what the JVMs tell you about their heaps varies by release and vendor. Here are some examples from a Java application I'm running: Sun's 1.6 JDK reports 32.7MB heap and the OS reports 48.6MB private bytes, leaving 16MB unaccounted for. All told, that's not so bad. In this case the compiled code and bytecodes are part of the 16MB. The same application running with the IBM® 1.5 JDK has a heap plus classloaders plus compiled code of 39MB, and the OS reports 45.8MB.
Typically, you can simplify the matter by focusing only on the Java heap. This is a sufficient approach for most Java applications and the spot where you can make the largest improvements. When that isn't the case, you should use your OS's tools to examine the native memory not covered by the Java heap.