memory snippets

How to debug memory allocation problems in PHP with Xdebug

Tagged xdebug, php, memory, error, performance  Languages php

Xdebug is a good tool for finding the root cause of memory allocation problems such as the one shown here:

Fatal error: Allowed memory size of X bytes exhausted (tried to allocate X bytes)

First install Xdebug by following the Xdebug installation instructions.

Next surround the code you suspect is causing the problem with the following function calls:

Bad bad PHP code

Read this blog entry by for more details