logoalt Hacker News

Someonelast Thursday at 6:15 PM2 repliesview on HN

> At the end of main, if the count wasn't balanced, then you knew you had a mismatch between malloc()/free().

A mismatch between malloc(0) and free(-1).

You’d know nothing about calls to malloc with non-zero sizes.


Replies

bobmcnamaralast Thursday at 11:37 PM

Those are identifiable by the end state of the heap not being empty.

sgerenserlast Thursday at 7:56 PM

Yeah, exactly, that’s my point. How many programs have memory leaks limited to (or even just materially affected by) 0-sized allocations? I’d have to imagine its a very small minority.

show 1 reply