Failure to build libjava on 512MB machine

Gerald Pfeifer
Thu Feb 1 21:19:00 GMT 2007

On Wed, 31 Jan 2007, Andrew Haley wrote:
> Can you tell us a bit more about the config?  It really shouldn't be
> failing to compile this program.

The tester where this problem first surfaced as a 32-bit Athlon machine,
with 512MB main memory and 1GB swap.  The machine runs FreeBSD 5.4.

I agree with your intuition that even if the machines is swapping heavily, 
this amount of virtual memory (1.5GB) should suffice.

However, a bit of investigations makes me believe that, at least in the 
default configuration, FreeBSD 5.4 will refuse to allocate more memory to 
a single process than the system has main memory.

At least this is what the output of the following quick test program I
hacked indicates:

  #include <stdio.h>
  #include <stdlib.h>
  #include <unistd.h>

  #define MB 1024*1024

  main() {
    for(int i=1; i <= 600; i++) {
      printf("%dMB  ",i); fflush(stdout);

      char *p=(char*)malloc(MB);
      if( p == NULL ) {
        return 1;

After 512MB, the output I get is


while, at the same time, a GCC bootstrap is nicely proceeding on the
same machine.  I do not know how many other system may behave similarly,
but at least this explains my (unexpected) bootstrap failures.


More information about the Gcc mailing list