#ifdef DEBUG_MEM fprintf(memlog, "malloced(%d)\n", pointer); #endif #ifdef DEBUG_MEM fprintf(memlog, "freed(%d)\n", pointer); #endif
Then I use perl to analyze the logfile. You can't just do it with eyeballs, because sometimes the same memory gets malloc()ed and freed a few times. Also, with XS, it's a little less explained what's happening when which macro is called... but the strategy is sound -- even if it's a small-project kind of strategy.
I also think, trying to do the demalloc in DESTROY is the wrong approach. It would be better to pull as much of the XS up into perl as possible. If you want automatic, use perl. If you want explicitly-detailed-and-micromanaged, use XS/C.
-Paul
In reply to Re: Handing Memory Leaks due to XS holding on to references
by jettero
in thread Handing Memory Leaks due to XS holding on to references
by kthakore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |