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 allocation functions look like?


#undef malloc
#undef free
#undef realloc

void* MyModule_Malloc (long size) {
 void* memory=malloc(size);
 return memory;
}

:) I'm using the OS memory management functions rather than perl's.

Cheers,

jez.


Reply via email to