As PHP 5.2.5 Doctrine does not GC graph objects • Don't fetch extra data from database in one-many relations • Fetch what you need! • In most HTTP served pages it might not be serious. • How ever in long running processes it leads to huge memory leaks •
from Doctrine objects to let PHP to GC the remaining objects. • The reason is objects have reference to their parents and children recursively. $query = $this->_em->createQuery ('…'); $result = $query->getResult (); $query->free ();