WordPress – Fatal error: Allowed memory size of bytes exhausted

WordPress - Fatal error: Allowed memory size

Does your WordPress site show a message similar to this?

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 19456 bytes) in wp-admin/includes/theme.php on line 81

If your answer is “yes”, this tutorial is for you.

We’ve helped several of our students with similar issues so we decided to write a tutorial to hopefully help someone else out as well.

Before starting to read this guide, it’s worth understanding what PHP errors are in WordPress.

Background Information About PHP Memory Limit

PHP Memory limit sets the maximum amount of memory in bytes that PHP allows to allocate to a script. This prevents poorly written scripts for eating up all available memory on a server.

In most cases, if you get a memory limit error it’s due to a faulty plugin. If you’re at 32 or 64 M limit, that should be more than enough.

If you set it to 128 M and still getting the error, then you for sure know it’s due to a faulty plugin. So the key question is what plugin did you install prior to this?

Things to Try

  1. Try adding this line to your wp-config.php file:
    define(‘WP_MEMORY_LIMIT’, ‘128M’);
  2. If you have access to your PHP.ini file, change the line in PHP.ini
    If your line shows 32M try 128M:
    memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)
  3. If you don’t have access to PHP.ini try adding this to an .htaccess file:
    php_value memory_limit 128M
  4. Talk to your host.
  5. If you have just updated a plugin and you’re seeing errors, try rolling back to a previous version.

Plugin for Keeping Track of Memory Usage

Use the TPC! Memory Usage plugin to track the memory usage in your WordPress.

TPC! Memory Usage allows WordPress administrators to view the current and peak memory usage of the application. This is extremely helpful when testing new plugins, or if there are a lot of modifications, plugins, or large language files. As of version 0.4, administrators now have the ability to view detailed system information about their web server, MySQL, PHP, and WordPress software. Chris Strosser”

Author

  • Nick Savov

    Nick is the Director of Support at OSTraining and you can find him in almost every area of the site, from answering support requests and account questions to creating tutorials and software.

0 0 votes
Article Rating
Subscribe
Notify of
3 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Fred Nelsen
Fred Nelsen
11 years ago

This worked like a charm. I had to install a wp site on networksolutions and had many snags. this was an easy fix. Thanks for the solution

GWS
GWS
11 years ago

The ‘things to try’ did not work for me, but the suggestion that it could be a faulty plugin led to a solution.

I found a few posts reporting that ‘wp super cache’ causes memory usage to soar, and sure enough, the fatal error messages disappeared when it was uninstalled. Sometimes best friends can make worst enemies..

AMB
AMB
11 years ago

I also had to deactivate “wp super cache” in order to have the WP work properly. I was searching the last few days for answers on how to increase memory (which did not work). Finally I decided to deactivate…….

3
0
Would love your thoughts, please comment.x
()
x