Hacker News new | past | comments | ask | show | jobs | submit login

1) The documentation doesn't show what file needs to be included; I think it's "mulle_allocator/mulle_allocator.h"

2) It can be convenient, in mulle_allocator.h, to have a define: #define malloc() mulle_malloc(). That way you don't actually need to dig through the code and replace anything.

3) If you're doing #defines, you can do something like this: #define malloc(a) mulle_malloc(a, __LINE__, __FILE__) which will let you keep track of the line and file where the memory was allocated.

4) If you're on Linux (which often C programmers are not) then mtrace() works really nicely for this.

5) It's always better to have more options for memory debugging, so good job!




I will update the documentation with the suggestion. I would not want to place the malloc #define in mulle_allocator.h though. First, it's too surprising. And second, it defeats the possibilty to isolate certain memory operations.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: