Heap size limit in java

Doug White dwhite at gumbysoft.com
Fri Jun 18 17:38:21 GMT 2004

On Fri, 18 Jun 2004, Paul Dlug wrote:

> I originally posed to my question to freebsd-java. My issue was that I
> was unable to set a java heap size of more than approx 2000m using java
> (-Xmx2000m), it would fail with the error "COuld not reserve enough
> space for object heap.

What do you have MAXDSIZ set to?

You're running into the limits of 32 bit memory addressing, probably.
FreeBSD reserves ~1.5GB of the 4GB address space for the kernel's use, and
gives the rest to userland.  You can adjust this boundary with the
KVA_PAGES kernel compile option, but you have to do some mean tuning to
avoid running out of KVM.  I have nameservers set up this way, but named
is the only thing running on the system.

On 64 bit platforms (sparc64, amd64), the limit is far enough away that
you won't encounter this specific problem.

The command line in question is:
# /usr/local/jdk1.4.2/bin/java -Xms256m -Xmx2024m
Doug White                    |  FreeBSD: The Power to Serve
dwhite at gumbysoft.com          |  www.FreeBSD.org

More information about the freebsd-current mailing list