4 ms·
I remember chasing down a memory leak in my first commercial C code. Took me a long while to discover that if you allocate zero bytes you still have to free it!
by beardyw 2y ago
I remember chasing down a memory leak in my first commercial C code. Took me a long while to discover that if you allocate zero bytes you still have to free it! After that I took nothing for granted.
- weinzierl 2y agoIt's not even guaranteed that it doesn't allocate, so a malloc(0) could cause an out of memory.
- ignoramous 2y ago> malloc(0) could cause an out of memory tbh, 640K RAM ought to be enough for anybody.
- weinzierl 2y agoFor the last drop to make the cup run over it doesn't matter how big the cup is.