Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Being aware of memory overuse
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-02-10 (21:31)
From: Goswin von Brederlow <goswin-v-b@w...>
Subject: Re: [Caml-list] Re: Being aware of memory overuse
Dario Teixeira <> writes:

> Hi,
>> I always wanted to have kernel spport for this. Some way for aplication
>> to tell the kernel about freeable memory and for the kernel to request
>> some memory to be freeed instead of swapping it out.
> If I recall correctly, there was an article reporting a lkml
> (the Linux kernel mailing list) discussion on that subject.  One of
> the proposals was for the kernel to send processes a signal (SIGFREE?)
> requesting they free up memory (by running a major GC, for example)
> whenever memory was running low.  In theory this could in some cases
> avoid the invocation of the draconian OOM killer.
> Question: just how effective such a feature would be in the Ocaml case?
> Best regards,
> Dario Teixeira

The danger of this on the other hand is that starting a mjor GC cycle
will most likely eat even more memory at first.

A signal would probably not be so helpfull. I was thinking more about a
memory preassure value. For example the kernel could provide a variable
in the vdso block saying:

0-100: You should shrink your memory usage to that many % of current
100+:  You could grow your memory to that many % of current

The kernel could consider the processes memory use, amount used for
caching in the process, other processes, general caching and the number
of hits to the pages to get a fair value for each process. and so on.

There could also be a SIGFREE signal to tell processes they must clean
up now or face the OOM killer but that would be secondary for me. I
don't ever want to see the OOM killer anyway.