@rici: Code which needs to be robust when hitting memory limits shouldn't be using malloc() and realloc() during allocation, but should instead allocate storage via some mechanism that allows programs to know how much memory they will be able to allocate safely, indicate that allocations may be considered "purgeable" when not locked, or use other such mechanisms the standard library lacks. Code which is using
malloc()
and
realloc()
during operation will in many cases have no way of handling low-memory sitautions robustly, no matter how hard programmers try. —
supercat 58 secs ago