

Show HN: Malcheck, a tool to test memory allocation failure handling - AndyKelley
https://github.com/andrewrk/malcheck

======
AndyKelley
I posted the idea for this yesterday morning[1] and got no responses but I
decided to make a proof of concept anyway :-). Then I made the mistake of
doing Show HN but not using a link[2] which /user?id=dang helpfully pointed
out was penalized. So, what the hell, here's a repost.

One problem that has presented itself is that "memory leak" is kind of a
subjective concept. It's really common to allocate memory and never free it,
because the memory need not be freed until the application shuts down.
valgrind has all kinds of voodoo to differentiate between memory intentionally
never freed and accidental memory leaks. So you end up in common situations
where the number of allocations is thousands more than the number of
deallocations, and there's still no leak.

So this can still help check the allocation failure handling code, but I don't
think it's going to be able to find memory leaks since there would be too many
false positives.

[1]:
[https://news.ycombinator.com/item?id=9977032](https://news.ycombinator.com/item?id=9977032)
[2]:
[https://news.ycombinator.com/item?id=9980477](https://news.ycombinator.com/item?id=9980477)

