virtual memory exhausted: Cannot allocate memory

Derrick Ryalls ryallsd at
Wed Feb 22 14:00:29 PST 2006

On 2/22/06, Ken Williams <zoo9000 at> wrote:
>     Hi FreeBSD folks,
>    I'm having trouble compiling the java/jdk15 package.  I've downloaded
> the
> files from Sun and eyesbeyond, as per usual. When I go to the jdk15
> directory and do 'make' the compilation starts and runs for an hour or two
> and then grinds to a halt with the following error message;
> ------------------------------------------------------------------------------
> gmake[3]: Leaving directory
> `/usr/ports/java/jdk15/work/control/build/bsd-i586/hotspot-i586/tmp/bsd_i486_compiler2/jvmg'
> gmake[3]: Entering directory
> `/usr/ports/java/jdk15/work/control/build/bsd-i586/hotspot-i586/tmp/bsd_i486_compiler2/jvmg'
> Compiling ../generated/adfiles/ad_i486.cpp
> virtual memory exhausted: Cannot allocate memory
> gmake[3]: *** [ad_i486.o] Error 1
> gmake[3]: Leaving directory
> `/usr/ports/java/jdk15/work/control/build/bsd-i586/hotspot-i586/tmp/bsd_i486_compiler2/jvmg'
> gmake[2]: *** [the_vm] Error 2
> gmake[2]: Leaving directory
> `/usr/ports/java/jdk15/work/control/build/bsd-i586/hotspot-i586/tmp/bsd_i486_compiler2/jvmg'
> gmake[1]: *** [jvmg] Error 2
> gmake[1]: Leaving directory
> `/usr/ports/java/jdk15/work/control/build/bsd-i586/hotspot-i586/tmp'
> gmake: *** [jvmg] Error 2
> *** Error code 2
> Stop in /usr/ports/java/jdk15.
> ------------------------------------------------------------------------------
>    The PC I'm using has a 2.3GHz Pentium, with 128MB memory and 70GB free
> disk space
> running FreeBSD-6.1PRERELEASE. Interestingly, when I run 'make' and do
> 'top'
> the compilation process steadily grows to 128MB in size and then stays at
> that size until it grinds to a halt.
>   I was under the impression that FreeBSD imposed a default maximum
> process
> size of 512MB, maybe that's changed or I was wrong (anyone ??). After
> Googling, I found that the way to increase the maximum process size was to
> add the following entries to /boot/loader.conf and reboot;
> root$ more /boot/loader.conf
> kern.maxdsiz="1073741824" # 1GB
> kern.dfldsiz="1073741824" # 1GB
> kern.maxssiz="134217728" # 128MB
>   I did this and tried compiling jdk15 again but it made no difference.
>   So I had the idea that another way to increase the amount of virtual
> memory available is to increase the amount of swap memory available
> (correct
> ??) which I did (to 1GB) as described in the Handbook here
> (
> ).
> This I did, and when I do 'top' it shows up as available swap memory but
> when I tried compiling jdk15 again it also made no difference.
>   I've also checked my resource limits (ulimit) but they look reasonable
> to
> me;
> root$ ulimit -SHacdflmnpstuv
> core file size        (blocks, -c) unlimited
> data seg size         (kbytes, -d) 524288
> file size             (blocks, -f) unlimited
> max locked memory     (kbytes, -l) unlimited
> max memory size       (kbytes, -m) unlimited
> open files                    (-n) 1735
> pipe size          (512 bytes, -p) 1
> stack size            (kbytes, -s) 65536
> cpu time             (seconds, -t) unlimited
> max user processes            (-u) 867
> virtual memory        (kbytes, -v) unlimited
>    For info, I also have java/linux-sun-jdk14 installed with linprocfs
> mounted (to bootstrap the jdk15 installation) but I don't think this is
> related to my problem.
>   I'm at a bit of a loss what to do next. Do I need to buy some more
> memory
> for my PC (just to compile jdk15) or is there anything else I can try or
> change in FreeBSD which may help me ?
>          Any help is much appreciated.
>     Ken
My video card has more memory than your system does.  Do you have any swap
space mounted/available?

/etc/fstab will tell you if you have a swap partition.  If you do (and it is
big) then I am not sure what the issue is, but is does sound like the system
is short on memory.  If you have no swap space partitioned, there is a way
to make a swapfile, but I have never done it myself.

More information about the freebsd-questions mailing list