Can a process use up more than 910MB?

From: Peter Tufvesson (tuwe@flakey.df.lth.se)
Date: Wed Jan 05 2000 - 17:17:58 EST


Hi all,

After reading/searching through this mailing list, I got the feeling a
process could use up to 3GB of virtual memory per default.

Since we really need this (We run commercial simulation tools like
ModelSim that uses up to 1.5GB today)

So, we write a small program (included below) to test this. The machine
had 1GB of physical memory and a a 2GB swap device. After each megabyte of
allocated memory the program prints the current allocated memory. Once no
more memory can be allocated, it sleeps for a while (long enough to check
the result with top) and then exits.

It turned out that a 2.1.12 kernel compiled for 1GB of physical memory
only allowed the process to allocate 910MB! Can anyone comment on this? I
believed it would be possible to use more... I also run two of these
processes in parallel, and then both got exactly the same amount, 910MB...

Thanks for everything.

/Peter

-----------------------------------

#include <string.h>
#include <stdlib.h>

main() {
  int i;
  void *x;
  x = (void *)4;
  for(i=0;x!=NULL;i++) {
    x = malloc(1024);
    if(x!=NULL) {
      memset(x,1024,6);
      if(i%1000)==0) {
        printf("malloc %d\n",i/1000);
      }
    }
  }
  sleep(20);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jan 07 2000 - 21:00:04 EST