To measure the total footprint of a process, you need to use an operating-system-specific
tool. In Unix-based systems, programs like top and ps can show you that data at a basic
level; on Windows, you can use perfmon or VMMap . No matter which tool and platform are
used, you need to look at the actual allocated memory (as opposed to the reserved memory)
of the process.
The distinction between allocated and reserved memory comes about as a result of the way
the JVM (and all programs) manage memory. Consider a heap that is specified with the para-
meters -Xms512m -Xmx2048m . The heap starts by using 512 MB, and it will be resized as
needed to meet the GC goals of the application.
That concept is the essential difference between committed (or allocated) memory and re-
served memory (sometimes called the virtual size of a process). The JVM must tell the oper-
ating system that it might need as much as 2 GB of memory for the heap, so that memory is
reserved: the operating system promises that when the JVM attempts to allocate additional
memory when it increases the size of the heap, that memory will be available.
Still, only 512 MB of that memory is actually allocated initially, and that 512 MB is all of the
memory that actually is being used (for the heap). That (actually allocated) memory is known
as the committed memory. The amount of committed memory will fluctuate as the heap res-
izes; in particular, as the heap size increases, the committed memory correspondingly in-