Try building with perl's malloc and -DDEBUGGING enabled. Ilya's wedged an amazing amount of tracking data into that memory allocator. Probably not quite enough to do what you want, but it's close. Unfortunately anything you might want to do will definitely require a custom perl, as you'd need to override the allocation and free routines. (This module has the advantage of being able to work standaline, as it doesn't have to intercept anything)