Welcome Guest, Not a member yet? Register   Sign In
Memory Exception with Debugbar and Doctrine


I was working on a project using CI 4 (in "development" environment) and Doctrine. All was working fine (creating new Entities, adding data to DB via Doctrine, retrieving them ...), but then I asked Doctrine (more specifically the EntityManager) to retrieve all the entries stored in DB for a specific Entity (3 entries in total). Suddenly, my page was loading indefinitely and eventually returned me an ErrorExceptionAllowed memory size of x bytes exhausted (tried to allocate x bytes)

The line concerned by this error was the 208th one of the System\Debug\Toolbar.php file:

PHP Code:
    $data['config'] = \CodeIgniter\Debug\Toolbar\Collectors\Config::display();

        if (
$response->CSP !== null)


It appears that the $data object was too big for the json_encode() method and led to an ErrorException. Indeed, I've found a debugbar.json file in the writable folder of 250+Mb.

This resulted in an Exception chain where the framework was trying to write and then read a file too big for the allowed memory size of the server. Sure enough, changing CI_ENVIRONMENT value to "production" resolved the issue (but that also meant no more Debugbar).

So, I was wondering if anyone had ever encountered such issue while working with CI 4 and Doctrine and, if so, how did you managed to resolve it?

Thanks!  Smile

(I can provide more information if needed: Doctrine implementation, CI 4 configuration, ...)

Messages In This Thread
Memory Exception with Debugbar and Doctrine - by troturier - 12-18-2019, 01:35 AM

Theme © iAndrew 2016 - Forum software by © MyBB