Support » Plugin: Wordfence Security » Allowed memory size of 268435456 bytes exhausted

  • Resolved Terence


    The server is a PHP7/NginX/Apache2 VPS at DigitalOcean.

    WordPress on the site and all the plugins including Wordfence are fully up to date.

    I am now seeing this occurring in the scan log on screen …

    Fatal error: Allowed memory size of 402653184 bytes exhausted (tried to allocate 22820118 bytes) in … /wp-content/plugins/wordfence/lib/wfConfig.php on line 661

    and I have found this in the logs …

    [Jan 25 00:16:33:1453706193.323888:1:error]
    <b>Fatal error</b>: Allowed memory size of 268435456 bytes exhausted (tried to allocate 1048576 bytes) in <b> … /public/wp-content/plugins/wordfence/lib/wfScanEngine.php</b> on line <b>517</b>

    I have now set the wpconfig-php as follows …

    define( ‘WP_MEMORY_LIMIT’, ‘384M’ );
    define( ‘WP_MAX_MEMORY_LIMIT’, ‘512M’ );

    But it doesn’t resolve the issue.

    Any chance of some guidance please?

    Many thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Jan Dembowski


    Brute Squad and Volunteer Moderator

    Please do not create multiple topics for the same thing. The new topic was deleted.

    That’s weird. I was almost sure I had posted already but I couldn’t find it.

    I take it it didn’t get answered and now the new one won’t either.

    So I am still none the wiser.

    Gee thanks.

    Plugin Author WFMattR



    That is a lot more memory than Wordfence normally needs — can you try temporarily disabling other plugins and running a Wordfence scan while they’re disabled? Wordfence will report the amount of memory it used at the end of a scan, so that would help narrow down if it is a Wordfence issue, or if another plugin is using so much memory that Wordfence just pushes it over the limit.

    You can also try turning on “Enable debugging mode (increases database load)” near the bottom of the Wordfence options page, which will give more details in the scan results, which may help as well.

    If you have any folders with a huge number of files (including some cache plugin folders), you can use the “Exclude files from scan that match these wildcard patterns” option to have those folders skipped in the scans to reduce memory usage as well.

    (I’ve seen some hiccups in the WP forums lately, where it seems that a post is missing, but it returns later — that might be what happened when you had made the second post.)

    -Matt R

    The memory allocation was more to do with a relatively large and very active WooCommerce installation on the site, than Wordfence.

    However, for whatever reason, I just revisited the site and the error message is no longer showing.

    In the intervening week there has been version updates and various changes made, so I have to imagine one of them is using way more memory.

    Thanks for coming back to me.


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Allowed memory size of 268435456 bytes exhausted’ is closed to new replies.