It's not the malloc that fails. It's the vm system trying to get a page
for you. At which point it might not be your process that is trying to
get a page when there are none free... So what should the kernel do?
Johnny
On 2022-06-14 12:01, Edgar Fuß wrote:
I have a program that keeps malloc()ing (and scribbling a bit into the
allocated memory) until malloc() fails. The intention is to put pressure
on the VM system to find out how much pool cache memory it can reclaim.
When I run that program (with swap space unconfigured), it doesn't terminate
normally, but gets killed by the kernel with "out of swap". Unfortunately,
other processes happening to malloc() during that time may get killed, too.
I don't quite get what the rationale for that is (or maybe I'm doing
something stupidely wrong). If I malloc(), and that fails, that should fail
and not kill me, no?
I'm surely missing something.
--
Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: b...@softjar.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol