recently i have problem when i trying to import a large text file(about 80M)into database by Doctrine and symfony2. Well, i always got a "out of memory" exception. After some searching job, i found this:   Commands are run in prod env by default but have debug enabled, it's   different than the app.php that is prod but where debug is   disabled ...    So using "php app/console xxx:xxx --no-debug" fixed the leaks because   there was no more SQLLogger.    An other solution was to use inside my Command:   $configuration = $this->em->getConnection()-> getConfiguration();   $configuration->setSQLLogger( null);      and the answer is this;  Disabling the logger is the only solution.   its probably not very useful to have the logger enabled in console aswell, but i dont see an immediate solution to fixing this.   You can of course do $em->getconfiguration()-> setSQLLogger(null); in the command   So well there is no way to do it in a de...