7 ms·
> 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
by renehsz 1y 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.
- pjmlp 1y agoOS specific hack and unrelated to C.
- tredre3 1y agoYour comment was also OS-specific because Windows doesn't lie to applications about failed allocations.
- pjmlp 1y agoNot 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.