While running some specific long-time import processes through Doctrine by running a Symfony 2 command, I noticed some memory leaks.
I’m using MongoDB on top of doctrine.
For example:
First import : 22 MB used
Last import (100k+): 500+ MB used
Couple of tips:
- Call $dm->clear() regularly to clean up doctrine cache. But, do not forget that all objects in cache will be swept
- This is the REAL tip: add –no-debug to your command line
php app/console --no-debug my:bundle:command
The 1st tip helps a little bit, the 2nd one is very efficient. And it has another impact: it speeds up the execution.