
On 18/10/11 10:43, Jason White wrote:
Toby Corkindale<toby.corkindale@strategicdata.com.au> wrote:
However, the default java implementation on 64bit machines assumes that it can grab a gigabyte or so up front, and generally does so! :/
I hope it wouldn't allocate a gigabyte just to run "hello world".
On my machine (w/6GB of RAM and a couple of GB of swap) java just allocated 1855M (virtual) of RAM to say "hello world" and sleep for 10 seconds. Of that, only 26M was resident, and about 9M of that was shared. However, if I pass the -Xmx2M flag, indicating I want it to only use 2M of memory, it'll still run just fine. However it still allocated 373M virtual, and 26M resident. So there's some overhead for the actual java system that's always allocated. But still.. by default allocating nearly 2GB?! Even with some degree of overcommit enabled, that's still crazy! I ran these tests with OpenJDK 6 and OpenJDK 7. Versions: OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre10-0ubuntu5) OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode) OpenJDK Runtime Environment (IcedTea7 2.0pre (7~b147-2.0~pre6-1ubuntu1) OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode) Toby