Doctrine 1
  1. Doctrine 1
  2. DC-282

Memory Leak in Doctrine_Query_Abstract._getDqlCallbackComponents()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.5
    • Fix Version/s: 1.2.0
    • Component/s: Query
    • Labels:
      None
    • Environment:
      PHP 5.2.11, Apache 2.2, Ubuntu Linux 9.1

      Description

      The following iteration shows increasing memory usage:

       $manager = Doctrine_Manager::getInstance();
      $manager->setAttribute(Doctrine::ATTR_USE_DQL_CALLBACKS, true);
      $manager->....connection....
      
      for($i=0; $i<10;$i++) {
        $tx = Doctrine_Query::create()
          ->from('Some_Entity cot')
          ->andWhere('cot.id = ?', $someid)
           ->fetchOne();
      			
        $usage = memory_get_usage();
        echo $i.': '.$usage."\n";
      }

      This results in an exceed-max-memory-fatal (750 MB) with a more complex application i am running that iterates >20,000 times.
      I found out that there is a memory leak in Doctrine_Query_Abstract._getDqlCallbackComponents():

      ...
      $copy->getSqlQuery($params);
      $componentsAfter = $copy->getQueryComponents();
      $copy->free(); //This is the solution
      ...

      Sincerly,
      Markus

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Markus Thielen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: