malloc does not return null when out of memory

Peter Jeremy peter.jeremy at alcatel.com.au
Thu Jul 24 14:50:25 PDT 2003


On 2003-Jul-24 04:35:14 +0200, Matthias Buelow <mkb at mukappabeta.de> wrote:
>What makes me ask the following (note that it's neither a flame, nor a 
>suggestion).  Does FreeBSD actually account the used swap/vm so far (it 
>needn't since it doesn't guarantee that it'll be available, with 
>overcommit) or does it not do that (i.e., it has no idea of how much vm 
>was requested by all processes so far, without having to go through the 
>maps of all processes, of course)?

Have a look at how systat(1) or top(1) calculate the number they
report.  AFAIK, the kernel doesn't accumulate this information into a
single total or make use of it in VM allocation decisions.

>  And is it planned in the (distant) 
>future to add a knob to toggle overcommitting of swap?

All I can say is I'm unaware of any such plan.  Based on the previous
threads, the VM experts appear to be either against this or don't see
any benefit.

>  While with large 
>disks and hence swap sizes this probably isn't a pressing problem for 
>most applications, it might be nice to be able to control the system not 
> to randomly kill off applications or force the user to meticulously 
>plan and calculate memory load of the planned application zoo in order 
>to tune the ulimits of various memory-hungry processes in a way that 
>they'll all fit into swap in the worst case situation.

This comes up every time this thread starts.  As I said before - read
the archives.  If you think you have a solution that works and avoids
at least the larger pitfalls (see the archives), you need to provide
patches (or show a willingness to pay someone else to write the code).

Peter


More information about the freebsd-stable mailing list