Skip to content

Instantly share code, notes, and snippets.

View LorisSigrist's full-sized avatar
🇨🇭

Loris Sigrist LorisSigrist

🇨🇭
View GitHub Profile
@LorisSigrist
LorisSigrist / main.md
Created February 13, 2026 12:32
Symfony Commands/Tests running out of Memory? Try `--no-debug`

I just spent way too much time chasing an out of memory error when running one of my Symfony Commands. Apparently the Doctrine ORM was holding on to too many entities. I tried flushing, clearing, all the usual stuff, but nothing worked.

Turns out, when running Symfony commands via php bin/console <command-name>, Doctrine's BacktraceDebugDataHolder is used, which NEVER DELETES ENTITIES. This was news to me too. Simply appending --no-debug disables this & seems to fix the issue.

I wish this was made more obvious.