I am trying to toggle the site mode for a new Drupal 8 development site. When I run the command drupal site:mode dev I get the following error:

PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1038876672 bytes) in phar:///usr/local/bin/drupal/vendor/twig/twig/lib/Twig/Extension/Debug.php on line 56

Increasing the memory (even to something huge) doesn't resolve this. Is Twig trying to throw an error, or output loads of data? How can I fix this please?


You're debugging an entity or other object somewhere that has recursive references and debug gets into an endless recursion until all memory is used up.

Instead of debug(node) or similar, use debug(node.toArray()), that gives you the raw value instead of huge object structures.

| improve this answer | |
  • Spot on, I was trying to call dump(page) in one of the templates and that was too much to handle. Thanks you. – Alex Holsgrove Dec 19 '16 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.