Moazam Rajas Sun hosted weblog garbage collection II

Monday Jul 19, 2004

I got an email from Fredrik Paulsson asking about my previous entry concerning "Why can't I allocate 2GB of heap to the JVM on Windows?" Fredrik (and others) have asked about the new /3GB and /PAE switches available in certain releases of Windows (2000/2003, AS/ES).

There is a description of the /3GB switch over at the Microsoft website.

Anyways, the use of this switch does not enable the JVM to allocate more than 2GB heap on Windows. Why? (The Sun VM engineers can step up and correct me here if I'm wrong) The Java Virtual Machine wants a contiguous allocation of memory. The /3GB switch in Windows does not allow that. The use of non-contiguous memory space for the 32bit JVM would most probably cause performance issues. Can you imagine doing garbage collection over 3GB of non-contiguous RAM? *shudder*

So what is the solution? Honestly, if you're going to use big RAM, just upgrade to 64bit CPUs and a 64bit OS. Windows, Linux, and Solaris all come in 64bit versions now.

PS> According to one of the Java GC gods here at Sun, "The Java object heap has to be allocated in contiguous virtual addresses, for implementation reasons." (P.Kessler)