I have a very long PHP script adapting multiple images and creating many arrays. At a certain moment I get the Fatal error: Allowed memory size of X bytes exhausted
error at a very random line:
if (isset($pixels[$x1+1][$y1+1])) return Array($x1+1,$y1+1);
So I know the problem is not really this line. What I want to do is somehow print the amount of memory exhausted already at several places throughout my script, so I can optimize my code to exhaust less and so I can see which code blocks are really memory-intensive. To do so I would need something like:
echo $memorySizeUsed."<br />";
Is there a way to do so, or do I have to dig just randomly?