views:

338

answers:

1

Hi,

I’m trying to quantify the difference in memory footprint of a small java app performing the same process multithreaded vs multiprocess.

All my tests are on Linux.

When running multithreaded, it is relatively easy to determine the overall footprint and additional overhead per thread. When running the single threaded process, the JVM has a large footprint (200-300M virtual space) according to pmap. If I run multiple copies of the same app, I see the memory footprint x N and none of the java code is shared between processes.

I have been informed that since java code is really data, not executable, it does not share code between processes as you would with say C executables. However, I was subsequently informed that it may use Copy-On-Write technology to achieve the same thing. If I use pmap, it just tells me the footprint for the process and doesn’t indicate how much may be shared with another process.

So the question is, how would I determine how much data is shared via Copy-On-Write between processes.

Many thanks.

A: 

On a correctly configured non-embedded linux system why would you care about the memory footprint ?

What difference would it make if you had an answer ?

Data would only be shared between processes if one was a proper ancestor of the other.
And it would be further determined by the memory layout of the java program and data within the pages. All of which could change from release to release.

codeDr