I have yet to find an elegant solution for this. I have a class with a method I want to track the memory usage of without modifying the function:
class Example {
The only trustable method I know to achieve this is profiling with tools that are not written in php itself.
Read this:
http://www.xdebug.org/docs/profiler