Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging PHP application after exit is called

Tags:

php

I have a PHP application that is using a very modest amount of memory until exit is called; at which point the memory usage spikes dramatically causing a fatal error due to exceeding the memory limit.

Is there any way to debug what the application/PHP is doing after exit is called? Alternatively, are there any common reasons for a massive increase in memory to occur at this time? The output buffers are empty when the script is terminated.

like image 422
Peter Horne Avatar asked Dec 30 '25 01:12

Peter Horne


1 Answers

You can register a shutdown function that will be executed when your script terminates, and that can be used to log memory usage, but I'm not sure how helpful it will be.

Do you have any unusual object __destruct() methods that might be grabbing memory as objects are destroyed? e.g. data writers.

like image 100
Mark Baker Avatar answered Dec 31 '25 15:12

Mark Baker