Failure to build libjava on 512MB machine

Gerald Pfeifer gerald@pfeifer.com
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 ) {
        printf("\nCrap!\n");
        return 1;
      }
    }
  }

After 512MB, the output I get is

  510MB
  511MB
  512MB
  Crap!

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.

Gerald



More information about the Java mailing list