It seems like you could do this with macros, no? Throw in an #ifdef DEBUG
that defines mymodule_malloc as a wrapper function, with an #else clause
that defines it as New.
I'm having a bit of trouble figuring out how to pass around the 4th arg to
New, the cast. What do your memory
Valgrind has just helped me track down a nasty segfault-producing bug in a
test app. This time, it turns out it was an invalid read in an XS
dependency and not something in in my own distro, but I'd like to continue
to use Valgrind as a troubleshooting aid going forward with my expanding
On Dec 5, 2005, at 12:27 PM, Jeremy White wrote:
Although not because of Valgrind, I ended up moving all of my
memory allocation into separate global functions. So I now have:
mymodule_malloc
mymodule_free
mymodule_realloc
This made tracking memory issues with Valgrind very simple.
It
I wrote:
It seems like you could do this with macros, no?
No. This doesn't do the trick; the place where the memory gets lost
is still hidden.
#ifdef MEM_LEAK_DEBUG
#define MemLeak_New(x,v,n,t) \
(v = (t*)MemLeak_New_void(x,(n*sizeof(t
#else
#define