Answers.Body: <p>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:</p>
  
  <ol>
  <li><p>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.</p></li>
  <li><p>More importantly, how your front-end templates are coded and how they are pulling in all of this data in.</p></li>
  </ol>
  
  <p>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 <a href="http://php.net/manual/en/ini.core.php#ini.memory-limit">something more reasonable</a>, like 128M.</p>
  
  <p>If you enable <a href="http://buildwithcraft.com/docs/config-settings#devMode">devMode</a>, you can view memory profiling information in your browser's console to help you see where the memory is being distributed.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-10T09:58:17.667Z
Answers.Text: 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.
Answers.UserDisplayName: Sven
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-22T16:13:04.307Z
Answers.LastActivityDate: 2014-07-22T16:13:04.307Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <p>An excessive amount of for / if statements can cause this. Try simplifying your templates.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-23T13:47:08.370Z
Answers.LastActivityDate: 2014-07-23T13:47:08.370Z
Answers.UserDisplayName: FrankFlitton
Body: <p>Getting the following when just querying the database for all records in a section (channel). There are about 75 entries. </p>
  
  <p>I'm getting the PHP Fatal error:</p>
  
  <blockquote>
    <p>Allowed memory size of 33554432 bytes exhausted (tried to allocate 32 bytes)</p>
  </blockquote>
  
  <p>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. </p>
  
  <p>I am using the SortByField plugin. Wonder if that's causing any issues. Here's my query:</p>
  
  <pre><code>{% for entry in craft.entries.section('people').find()|sortByField('lastName', 'asc') %}
       // ... outputting names of people, etc.
  {% endfor %}
  </code></pre>
  
Tags: <database><error-message>
Title: PHP Fatal error: Allowed memory size of X bytes exhausted
ThreadText: # PHP Fatal error: Allowed memory size of X bytes exhausted
  
  (Asked by: username_0 on 2014-07-22)
  
  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 %}
  
  ```
  
  **Tags:** database, error-message
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2014-07-22. Score: 7
  
  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](http://php.net/manual/en/ini.core.php#ini.memory-limit), like 128M.
  
  If you enable [devMode](http://buildwithcraft.com/docs/config-settings#devMode), you can view memory profiling information in your browser's console to help you see where the memory is being distributed.
  
  > **Comments:**
  > **username_2**: 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.  
  
  ---
  
  ### Answer by username_3 on 2014-07-23. Score: 1
  
  An excessive amount of for / if statements can cause this. Try simplifying your templates.
  
  
  ---
  
  