Hint to avoid memory exhausted error (Symfony + doctrine1.2)
Let's solve this extremely annoying problem of Sf1.2
It is usual to have tasks that load a lot of objects from the database and do something with them. It can be generating a sitemap, generating thumbnails, etc.
When you do that, it is very likely that you find memory exhaustion problems like:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /blablabla/lib/vendor/symfony/lib/log/sfVarLogger.class.php on line 170
How to overcome this? Luckily I found this thread on the symfony group. If I had discovered that thread earlier it would have saved a lot of time, so I’m replicating the solution here :)
The problem is that the doctrine profiler is enabled for sfBaseTask, as sf_debug is set to true.
To disable the profiler, you have to create a new environment in config/databases.yml:
And then run the task with the option