3 ms·
Malloc does not fail under Linux unless you are in very peculiar circumstances.
by orbifold 8y ago
Malloc does not fail under Linux unless you are in very peculiar circumstances.
- jcranmer 8y agoMalloc will still fail for overly large allocation sizes. If you try to malloc(-1), for example.
- krylon 8y agoNot everyone is running Linux. And anyway, it is dirty - like crossing the street without looking for cars because traffic around here is very mellow, or peeing without washing your hands afterwards. (That being said, I once helped somebody to write a program whose task it was to deliberately get the host system to the point where malloc(3) failed. It was not as trivial as one might think.)