sbrk(2) broken
Kris Kennaway
kris at FreeBSD.org
Fri Jan 4 03:31:15 PST 2008
Igor Mozolevsky wrote:
> On 04/01/2008, Dag-Erling Smørgrav <des at des.no> wrote:
>
>> For the same reason as it has for the last 20 years or so: memory
>> overcommit, which means that malloc() allocates address space, not
>> memory. Actual memory is allocated on-demand when the address space is
>> used (read from or written to). If there is no RAM left and none can be
>> freed by swapping out, the process gets killed. The process that gets
>> killed is not necessarily the memory hog, it is merely the process that
>> is unlucky enough to touch a new page at the wrong moment, i.e. when all
>> RAM and swap is exhausted *or* everything in RAM is wired down and
>> unswappable.
>
> Broadcasting SIGDANGER would be a much better option; followed by
> SIGTERM to the memory hogger (to allow for graceful termination) and
> only then SIGKILL. I can imagine a few (legitimate) scenarios when a
> user process would want to hog as much RAM as possible...
Do everyone a favour and research the topic in the archives, please.
Another thread on the subject will just waste everyone's time.
Kris
More information about the freebsd-current
mailing list