Symfony2: Huge transactions cause memory leak

…or they seem like to cause one – I noticed while I was testing the latest ComPPI build. As it turned out, the continuously increasing memory consumption was caused by the built in logger component. The following snippet takes care of it:

 1 <?php
 2 use Doctrine\ORM\EntityManager;
 3 
 4 /**
 5  * Disables SQL logging.
 6  *
 7  * Call this before the first large transaction
 8  */
 9 function initEntityManager(EntityManager $em) {
10     $em->connection->getConfiguration()->setSQLLogger(null);
11 }

Published: May 30, 2012.