2001-12-05 11:11:48

by Adam McKenna

[permalink] [raw]
Subject: Maximum heap size?

I have been STFW'ing for a few hours now and I keep finding conflicting
reports on what the maximum heap size is with Linux 2.4. Some places say it
is 1GB, and others say it is unlimited.

Background: We have a java process that dies if the -mx flag passed to java
is more than 1GB. Our developers say it is a Linux bug (since we don't
have the same problem on Solaris). We are using Sun J2SE/JDK 1.3.1.

Any clarification would be appreciated.

Thanks,

--Adam


2001-12-05 11:18:18

by Alan

[permalink] [raw]
Subject: Re: Maximum heap size?

> I have been STFW'ing for a few hours now and I keep finding conflicting
> reports on what the maximum heap size is with Linux 2.4. Some places say it
> is 1GB, and others say it is unlimited.

You have 3Gb of virtual space for an application on x86. This is basically
hardware limitations of the processor (1Gb is used for kernel mappings and
having kernel and user mappings overlapping costs every syscall)

If you are hitting a 1GB limit I would assume the jvm isn't very bright
about its allocation of resources. You should run out at something like
2.5Gb of allocations. (you lose some to app and library maps)

Alan

2001-12-05 20:47:36

by Dan Maas

[permalink] [raw]
Subject: Re: Maximum heap size?

> If you are hitting a 1GB limit I would assume the jvm isn't very bright
> about its allocation of resources. You should run out at something like
> 2.5Gb of allocations. (you lose some to app and library maps)

Specifically, the jvm is probably getting memory from brk(), because brk()
only operates in the ~1GB region between 0x08000000 + epsilon (where the
executable ends) and 0x40000000 (where shared libs begin). The easiest way
to get more than 1GB is to mmap() anonymous pages (which will come from the
remaining ~2GB region between 0x40000000 and 0xBFFFFFFF). e.g. glibc will
use anonymous mmap() to fulfill large malloc() requests.

Regards,
Dan