Oh doctrine, those were the days... I spent a couple years working on a project that was eventually rewritten in rails because there was a memory leak that required restarting the server ever night via cron.
Yeah, PHP scripts in CRON, especially those using some relational database were my nemesis that time too. The nice thing, which in PHP 5.5 was introduced is generators, that almost completely resolved the problem with memory leakage in such scripts IMHO.
[0]: https://www.php.net/manual/en/language.generators.overview.p...