php/symfony/doctrine memory leak?

后端 未结 9 1785
旧时难觅i
旧时难觅i 2020-11-30 00:34

I\'m having problems with a batch insertion of objects into a database using symfony 1.4 and doctrine 1.2.

My model has a certain kind of object called \"Sector\", e

9条回答
  •  难免孤独
    2020-11-30 01:39

    For a symfony task, I also faced to this issue and done following things. It worked for me.

    • Disable debug mode. Add following before db connection initialize

      sfConfig::set('sf_debug', false);
      
    • Set auto query object free attribute for db connection

      $connection->setAttribute(Doctrine_Core::ATTR_AUTO_FREE_QUERY_OBJECTS, true );
      
    • Free all object after use

      $object_name->free()
      
    • Unset all arrays after use unset($array_name)

    • Check all doctrine queries used on task. Free all queries after use. $q->free() (This is a good practice for any time of query using.)

    That's all. Hope it may help someone.

提交回复
热议问题