[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memory allocation on linux



On Wed, 7 Aug 2002, Cannizzaro, Emanuele wrote:

> I am writing to you regarding your experience to address a huge amount of
> memory on linux using the brk() function.
>
> I am running a program called nastran (v2001) on a pc with redhat 7.2. This
> machine has got 2GB of disk spacebut  when I set the amount of memory to be
> used by nastran to a value bigger than 900 mb I get this fatal error message.
>
> Process Id = 28179
> idalloc: dynamic allocation failed - brk: Cannot allocate memory

The problem is that you have your libc mapped at 1GB offset
and the program executable at 128 MB, leaving about 900 MB
of space for brk().

> I have no access to the source code of the program and therefore I would
> need a patch to the memory allocation.
>
> how can this problem be fixed?

If the program is dynamically linked you could try using a
libc that uses malloc() instead of brk().

If the program uses brk, you could hack the kernel to start
mmap() at a different offset (eg 2 GB).

The easiest and arguably best option would be to link the
program statically so it doesn't have to mmap any libraries,
but it seems like you're stuck with whatever binary was given
to you so you'll have to work around the problem...

regards,

Rik
-- 
Bravely reimplemented by the knights who say "NIH".

http://www.surriel.com/		http://distro.conectiva.com/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/