Skip to content

Instantly share code, notes, and snippets.

@LorisSigrist
Created February 13, 2026 12:32
Show Gist options
  • Select an option

  • Save LorisSigrist/9816194df81980412a6b360e71e86b5e to your computer and use it in GitHub Desktop.

Select an option

Save LorisSigrist/9816194df81980412a6b360e71e86b5e to your computer and use it in GitHub Desktop.
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment