4 ms·
> 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
by Someone 1y ago
> 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.
- sgerenser 1y agoYeah, 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.
- bobmcnamara 1y agoThey're uncommon for sure. In the past they've been an issue for me on constrained systems where they can frag the heap as badly as any other long lived allocation.
- bobmcnamara 1y agoThose are identifiable by the end state of the heap not being empty.