php/symfony/doctrine memory leak?

Tried doing

$cupo->save();
$cupo->free();
$cupo = null;

(But substituting my code) And I’m still getting memory overflows. Any other ideas, SO?

Update:

I created a new environment in my databases.yml, that looks like:

all:
  doctrine:
    class: sfDoctrineDatabase
    param:
      dsn: 'mysql:host=localhost;dbname=.......'
      username: .....
      password: .....
      profiler: false

The profiler: false entry disables doctrine’s query logging, that normally keeps a copy of every query you make. It didn’t stop the memory leakage, but I was able to get about twice as far through my data importing as I was without it.

Update 2

I added

Doctrine_Manager::connection()->setAttribute(Doctrine_Core::ATTR_AUTO_FREE_QUERY_OBJECTS, true ); 

before running my queries, and changed

$cupo = null;

to

unset($cupo);

And now my script has been churning away happily. I’m pretty sure it will finish without running out of RAM this time.

Update 3

Yup. That’s the winning combo.

Leave a Comment