How to see whats eating my swap space on linux

0

I have a unique situation here where a Java app I wrote is choking when it forks and creates some child processes. According to the error logs I'm seeing there is a java.lang.UNIXProcess method allocates space for both the parent and child process outside the JVM in the system's swap space. The errors are being thrown because there is not enough swap space to contain both the parent and child process at the same time.

Systems is throwing a fit and doesn't want to increase swap space without good reason, so I'm trying to see if there are any rogue processes that are eating into the available swap space at the same time that this forking is occurring. If I can prove that the swap space needs to be increased to handle both my parent/child processes as well as something else that systems needs running (like a security scan, etc.), then I can get my ticket approved and go home.

What would SuperUser do?

Edit: I should note that these errors are only occurring on our shared QA machine that has a lot of other projects/apps running on it. On our isolated dev machine this works like a charm, and that dev machine is a mirror of QA from a hardware/virtual memory/disk perspective. So if passing on dev and failing on QA, that strongly indicates that my app is simply competing for swap space that just isn't available because someone else is using it.

pnongrata

Posted 2012-06-13T18:38:23.633

Reputation: 2 212

which version of Solaris? – Yedric – 2012-09-27T16:11:39.700

Answers

0

In Solaris, it does not matter whether the backing store for the virtual memory a process is using, or is requesting, is physical RAM or swap space. You need to look at how much memory is in use system wide, not what is actually paged out at the time. This INCLUDES the /tmp filesystem.

NOTE: Solaris uses a memory based filesystem for /tmp, by default. The files & directory structure in /tmp use virtual memory from the system pool. The available space in /tmp is determined by the amount of virtual memory available system wide.

On Solaris 9 and later, use prstat -c -s size -n <# of processes to show> 0 1 to get a list of all running processes, sorted in descending order by the amount of virtual memory each is using. See the "SIZE" column for the total virtual memory in use by each process.

Yedric

Posted 2012-06-13T18:38:23.633

Reputation: 649