I came across the same issue recently, couldn't find any specific tools unfortunately.
But something that helped was to output the xdebug trace in human readable format with mem deltas enabled (an INI setting, xdebug.show_mem_deltas or something I think?). Then run sort (if you are on *nix) on the output:
sort -bgrk 3 -o sorted.txt mytracefile.xt
That sorts on the third col, the mem deltas. You can also sort on the second column, in which case you can find the line at which your app uses the most memory in total.
Of course, this can't detect when an object's memory usage only creeps up in small increments but ends up using a lot of memory overall. I have a fairly dumb method that attempts to do this using a combination of object iteration and serialization. It probably doesn't equate exactly to memory usage, but hopefully gives an idea of where to start looking. Bear in mind it will use up memory itself, and also has not been extensively tested, so buyer beware:
function analyzeMem($obj, $deep=false)
{
if (!is_scalar($obj))
{
$usage = array('Total'=>strlen(serialize($obj)));
while (list($prop, $propVal) = each($obj))
{
if ($deep && (is_object($propVal) || is_array($propVal)))
{
$usage['Children'][$prop] = analyzeMem($propVal);
}
else
{
$usage['Children'][$prop] = strlen(serialize($propVal));
}
}
return $usage;
}
else
{
return strlen(serialize($obj));
}
}
print_r(analyzeMem(get_defined_vars()));
Also, just got suggested this method by a colleague (cheers Dennis ;-) This hides the steps that are below 2 levels of indentation, you can quite easily see the points where the overall memory usage jumps up, and can narrow things down by increasing the indentation:
egrep '[0-9]+ ( ){1,2}-> ' mytracefile.xt