I’ve been tinkering with GlassFish 2.1.1 lately, on both an Ubuntu Linux box as well as a Windows XP one.
Looking at the “java” processes representing asadmin, JavaDB server, and the GlassFish app server domain itself on Windows (using the Task Manager), they add up to just over 100 MB of memory.
However, looking at the same processes on the Linux box (using “ps aux” and the Gnome System Monitor) show memory usage in the ballpark of 800 MB.
This seems extremely odd to me. If anything, I would have assumed memory usage to be less favorable on Windows. Either way, I wouldn’t have expected the swing between the two to be THAT dramatic. Is there something fundamental that I’m missing here? I don’t necessarily need detailed profiling information, I just need a roughly accurate figure for total memory use (real world) on the two platforms.
Advertisement
Answer
Because you’re measuring it differently.
It is notoriously difficult to measure memory usage on systems which support virtual memory and shared memory; both Linux and Windows fall into this category.
Basically it stems around
- Do you count pages which are allocated but not mapped in just now?
- Do you count potentially shared pages? (e.g. those from mapped files / executables / libraries etc)
The answers aren’t so trivial.
Linux provides two “easy” memory measurements, RSS and VM size, neither of which exactly represents what people typically think they mean when they say “how much memory is it using”. What programmers think they mean often falls somewhere in between RSS and VM size.