Getting the following when just querying the database for all records in a section (channel). There are about 75 entries.

I'm getting the PHP Fatal error:

Allowed memory size of 33554432 bytes exhausted (tried to allocate 32 bytes)

Why would i be running out of 32MB for these pretty simple entries? The channel entry type just has a title, body, image URL, text field, and a field referencing another channel entry type.

I am using the SortByField plugin. Wonder if that's causing any issues. Here's my query:

{% for entry in craft.entries.section('people').find()|sortByField('lastName', 'asc') %}
     // ... outputting names of people, etc.
{% endfor %}

2 Answers 2


Craft will run out-of-the-box with 32M of memory, no problem. However, memory consumption will start to increase depending on several factors including:

  1. The complexity of your site, including the number of fields, sections (and types of sections), categories, tags, users, entries, plugins in use (and how efficient they are working), etc.

  2. More importantly, how your front-end templates are coded and how they are pulling in all of this data in.

Also worth noting that 32M is usually the default on older PHP installs (or really stingy newer hosts) and the latest PHP releases ship with something more reasonable, like 128M.

If you enable devMode, you can view memory profiling information in your browser's console to help you see where the memory is being distributed.

  • I have the same error happening in /craft/app/vendor/pixelandtonic/imagine/lib/Imagine/Gd/Image.php on line 617. My memory already is set to 128M. I am using Imager plugin to generate images.
    – Sven
    Jan 10, 2017 at 9:58

An excessive amount of for / if statements can cause this. Try simplifying your templates.

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.