Menu

Fix WordPress Memory Exhausted Error
📰

Fix WordPress Memory Exhausted Error

DEV Community: php·Md. Zubaer Ahammed·43 minutes ago
#nmwRIna6
#devto#dev#plugin#wordpress#memory
Reading 0:00
15s threshold

The WordPress memory exhausted error is a PHP fatal, not a WordPress bug. When a request prints Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) , PHP stopped at the ceiling set for that process. Raising the ceiling is the easy half. Finding the code that filled it is the half that stops the error coming back next Tuesday.

The file named in the fatal error is the last straw, not the cause

Read the message in three parts before touching a file:

268435456 bytes is the limit at the moment of death: 256 MB here. Compare it with what you assumed the limit was.

20480 bytes is the allocation that failed. A small number means the request was already full and something earlier consumed the memory. A large number points at one operation: an image resize, a CSV import, a query pulling 50,000 rows.

wp-includes/… on line N is where it died, which is rarely where it started.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.