Hacker News new | ask | show | jobs
by renehsz 250 days ago
> It also assumes that the OS doesn't lie to the application when allocations fail.

Gotta do the good ol'

  echo 2 >/proc/sys/vm/overcommit_memory
and maybe adjust overcommit_ratio as well to make sure the memory you allocated is actually available.
1 comments

OS specific hack and unrelated to C.
Your comment was also OS-specific because Windows doesn't lie to applications about failed allocations.
Not at all, rather there is no guarantee that the C abstract machine described on ISO C, actually returns NULL on memory allocation failures as some C advocates without ISO C legalese expertise seem to advocate.