phpmemory-leaksout-of-memoryxdebugxdebug-profiler

Xdebug profiler: only dump on PHP memory limit


Is it possible to only have Xdebug dump profile information when PHP hits a memory limit?

I don't see any settings to support this, similar to what php-memprof does with dump_on_limit.


Solution

  • This is not possible with Xdebug's current architecture. When the profiler is enabled, Xdebug writes the information to a file while it is being run. It needs to collect the data regardless.

    The feature that you're asking for, is basically an automated deletion of the generated file if the memory limit has not been hit.