Re: 2GB-Memory-Linux: Strange Behavior

MOLNAR Ingo (mingo@chiara.csoma.elte.hu)
Sat, 17 Jan 1998 12:45:39 +0100 (CET)


On Fri, 16 Jan 1998, Xintian Wu wrote:

> However, I notice that
> (a) a single job seems to have a memory limit of 1GB, because I get
> memory allocation error when the VSZ on top figure shows roughly
> 900MB (in both mmap and shm cases).

i suppose that 'anonymous mmap()'-s fail in this case. This is what is
used by malloc() and all usual allocators. Now, there is a limit, which is
not 2GB but:

processor.h:#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)

in your case this is 2G/3=666MB. Which means your system will give at most
1.333G memory to the process. [unless i'm missing some libc mechanizms].
To get more per-process anonymous mappings, simply do the following,
change include/asm-i386/processor.h:line 82 to:

#define TASK_UNMAPPED_BASE (TASK_SIZE / 8)

this should give 256M space to normal 'file mappings', and ~1700M to
'freely allocatable memory'. Do 'cat /proc/1234/maps' to see how your
program allocates memory.

> (b) swap space seems to be totally forgot by the system.

yes, since this is not physical memory shortage, but virtual memory
'shortage'. We are hitting 32 bitness limits ...

-- mingo