<p>Most likely you'll need to add this line to the Craft config file (<code>craft/config/general.php</code>)...</p>

<pre><code>'phpMaxMemoryLimit' =&gt; '512M',
</code></pre>

<ul>
<li><a href="https://docs.craftcms.com/v2/config-settings.html#phpmaxmemorylimit" rel="nofollow noreferrer">Craft 2 docs</a></li>
<li><a href="https://docs.craftcms.com/v3/config/config-settings.html#phpmaxmemorylimit" rel="nofollow noreferrer">Craft 3 docs</a></li>
</ul>

CC BY-SA 4.0
2021-02-16T10:13:20.710Z
I don't know if there is a behaviour difference between Craft 2 and 3, but reading the Craft 3 docs suggests not specifying `phpMaxMemoryLimit` i.e. null basically means it will try and use the max available anyway, so why set a fixed value?
James White
CC BY-SA 4.0
2018-03-26T16:28:47.277Z
2018-11-06T11:46:19.723Z
2018-11-06T11:46:19.723Z
Jalen Davenport
<p>I renamed a channel section and Craft (2.6.3012) is trying to resave all the entries therein (about 500 entries, many with up to 10 localized versions). I'm constantly getting this error (in <code>/craft/storage/runtime/logs/phperrors.log</code>):</p>

<pre><code>[26-Mar-2018 15:53:40 UTC] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 43 bytes) in C:\server\project_x\craft\app\helpers\ModelHelper.php on line 95
</code></pre>

<p>Here's the thing... in <code>php.ini</code>, the <code>memory_limit</code> setting is set to <code>512M</code>. Not the <code>256M</code> one would expect from the error. In Craft's <code>admin/utils/phpinfo</code> page, it shows that PHP does indeed have a limit of 512Mb, but the process still hits a mysterious memory limit at 256MB.</p>

<p>I'm running locally on XAMPP, PHP 5.6.24 (switching to PHP 7 prevents me from being able to login for some reason), and this is just part of setting up a site, so I don't care about performance or advisable settings with this issue.</p>

<p>What am I missing?</p>

<memory><stalled-tasks>
Resaving Entries hitting a mysterious memory limit
# Resaving Entries hitting a mysterious memory limit

(Asked by: username_0 on 2018-03-26)

I renamed a channel section and Craft (2.6.3012) is trying to resave all the entries therein (about 500 entries, many with up to 10 localized versions). I'm constantly getting this error (in /craft/storage/runtime/logs/phperrors.log):
[26-Mar-2018 15:53:40 UTC] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 43 bytes) in C:\server\project_x\craft\app\helpers\ModelHelper.php on line 95

Here's the thing... in php.ini, the memory_limit setting is set to 512M. Not the 256M one would expect from the error. In Craft's admin/utils/phpinfo page, it shows that PHP does indeed have a limit of 512Mb, but the process still hits a mysterious memory limit at 256MB.
I'm running locally on XAMPP, PHP 5.6.24 (switching to PHP 7 prevents me from being able to login for some reason), and this is just part of setting up a site, so I don't care about performance or advisable settings with this issue.
What am I missing?

**Tags:** memory, stalled-tasks

---

## 1 answers

### Answer by username_1 on 2018-03-26. Score: 5 | Accepted answer

Most likely you'll need to add this line to the Craft config file (craft/config/general.php)...
'phpMaxMemoryLimit' => '512M',


Craft 2 docs
Craft 3 docs

> **Comments:**
> **username_2**: I don't know if there is a behaviour difference between Craft 2 and 3, but reading the Craft 3 docs suggests not specifying `phpMaxMemoryLimit` i.e. null basically means it will try and use the max available anyway, so why set a fixed value?  

---

