Re: 2GB process crashing on 2.4.14

Andi Kleen
2001-12-07T14:03:14Z

Paul Sargent <Paul.Sargent@3dlabs.com> writes:

> So if I was hitting this limit then I should see no / very few gaps, in the
> /proc/<pid>/maps. Is that true?

It usually fails when malloc() hits your libraries. One solution is to
recompile the kernel with a higher TASK_UNMAPPED_BASE (should be a sysctl,
but is a fixed define currently). That would force the shared libraries
to start at a higher address and give sbrk() more breathing space.

Another way is to use mallopt(M_MMAP_THRESHOLD, ..) and set a low mmap
threshold. This allows malloc to use mmap earlier instead of sbrk() and skip
the shared library area. It comes at a cost thought, malloc() tends to
become more expensive.

With some more changes you can also force the user space to 3.5GB, at the
cost of much less kernel memory. It usually makes sense to change
TASK_UNMAPPED_BASE with this.

-Andi

P.S.: I'm pretty sure this is a FAQ.