pro_linux_programming thread: malloc problem.
Hi,
Another way to tackle this problem is to start your application from a shell
that has a restriction set on its maximum virtual memory size.
In a bash shell:
ulimit -v 8192
application
will run application with 8Mb maximum memory. When the limit is reached,
malloc will return NULL.
Neil
----- Original Message -----
From: "millward" <millward@M...>
To: "Pro Linux Programming" <pro_linux_programming@p...>
Sent: Tuesday, March 04, 2003 10:46 PM
Subject: [pro_linux_programming] malloc problem.
> Can anyone tell me how to avoid the following
> potential big problem with GNU C malloc()?
> This is a quote from the man file of malloc in
> Red Hat 7.3
> " Linux follows an optimistic memory allocation strategy.
> This means that when malloc() returns non-NULL there is no
> guarantee that the memory really is available. In case it
> turns out that the system is out of memory, one or more
> processes will be killed by the infamous OOM killer."
> So how do you make sure your program does not get
> killed by the infamous OOM killer?
>
>
>
>
>