WP Debug Toolkit (WPDT) detects PHP out-of-memory (OOM) errors and sends you an email notification even though the request has fatally crashed and normal execution has stopped. This works because the WPDT MU-plugin reserves 256KB of memory at startup specifically for this purpose, freeing it the moment the shutdown handler fires so the alert can go out. To adjust your site’s memory limit, navigate to WP Debug Toolkit › Settings › PHP Settings.
When PHP exhausts its available memory, the process terminates immediately. The entry left in debug.log looks like this:
[15-Mar-2026 14:32:10 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 65536 bytes) in /wp-content/plugins/example-plugin/includes/class-import.php on line 215The first number, 268435456, is the configured memory limit in bytes (268,435,456 bytes = 256MB). The second number, 65536, is the size of the allocation that pushed PHP past that limit. No code runs after this point. Normal execution has stopped.
A standard PHP error handler requires memory to execute. When a process runs out of memory, the handler cannot run because the one resource it needs is gone. Standard PHP logging still writes the entry to debug.log, but no email notification system built on wp_mail() or a regular plugin can fire afterward: there is nothing left to execute it. This is why OOM errors are uniquely difficult to surface in real time. By definition, the moment they occur, the normal error-reporting pipeline cannot respond.
WPDT’s MU-plugin handles OOM errors through three connected mechanisms. They work together to turn what would otherwise be a silent crash into a notification that reaches you within seconds.
When wpdebugtoolkit-notifications.php loads at WordPress startup, before any regular plugin, WPDT reserves a dedicated block of memory:
php
// 256KB reserved at initialization -- held until a shutdown event fires
self::$memory = str_repeat( '*', 1024 * self::RESERVED_MEMORY_KB );This reserved block sits unused while your site runs. During an OOM crash, the sequence is:
This mechanism is automatic and does not require you to configure any additional settings.
After releasing the reserved memory, the shutdown handler calls error_get_last() to retrieve the error details. It then builds a notification email containing the Error Type, Message, File, Line, Time, and Request Details.
For recoverable fatal errors, which is the category that includes OOM events, WPDT intercepts WordPress’s own recovery email, suppresses it, and sends its own version in its place.
This gives WPDT control over the email content and format while still using WordPress’s recovery URL, which carries the extension tracking needed to safely deactivate the offending plugin or theme. The email includes a Recovery URL that gives you access to WordPress admin safely, and a direct link to the standalone Viewer App.
WPDT sends the email via wp_mail(). If wp_mail() fails because WordPress is in a broken state at the time of the crash, WPDT falls back automatically to PHP’s native mail() function.
OOM error messages include a variable component: the “tried to allocate X bytes” portion changes with every crash because the allocation size differs. Without normalization, each crash from the same plugin would generate a unique hash, bypass rate limiting, and flood your inbox.
WPDT strips the allocation size from any message beginning with “Allowed memory” before hashing it, so repeated crashes from the same file and line share a single error hash. Rate limiting then applies to the error source rather than to each individual crash.
✅ Key Guarantees
wp_mail() fails during shutdown, WPDT falls back to PHP’s native mail() function automatically.Most OOM errors on WordPress sites trace back to one of these events:
Set WP_MEMORY_LIMIT in wp-config.php to give WordPress more headroom:
php
// Set in wp-config.php — may not be able to exceed the server's PHP memory_limit in php.ini
define( 'WP_MEMORY_LIMIT', '256M' );On most hosts, WordPress applies WP_MEMORY_LIMIT via ini_set(), which can raise memory above the php.ini default. If your host locks memory or disables ini_set(), however, the php.ini value becomes a hard ceiling that WP_MEMORY_LIMIT cannot override.
On hosts where wp-config.php is writable, you can also set this value from WP Debug Toolkit › Settings › PHP Settings › Memory Limit (wp-config.php)
The file path in the OOM error message tells you what to investigate:
Open the error entry in the WPDT Error Log Viewer App to inspect the responsible file directly.
Check whether recurring OOM errors correlate with specific actions such as imports, scheduled cron jobs, or particular page loads. WPDT keeps a 7-day alert history, including suppressed notifications. Because WPDT normalizes OOM messages before hashing, repeated crashes from the same file and line share one signature in the history log, making it straightforward to confirm whether one source drives multiple incidents.
A regular WordPress plugin loads after WordPress finishes initializing and after other plugins load. If a plugin earlier in the sequence causes a fatal error, a standard plugin may never load at all. The MU-plugin wpdebugtoolkit-notifications.php loads first in the WordPress boot sequence, which means its shutdown handler is registered before any regular plugin code runs. WPDT can therefore capture and report fatal errors that occur in plugins that load afterwards.
Not always. If the error hash matches a recent notification within the active rate limit window, WPDT suppresses the duplicate and records it in the alert history instead of sending a second email. If the global hourly cap for fatal errors has been reached, WPDT logs the skipped notification rather than sending it. Both suppressed and sent notifications appear in the 7-day alert history.
Open the alert history and check whether the repeated notifications share the same error hash. If they do, rate limiting will suppress further duplicates within the cooldown window automatically. If the volume is still too high, the per-error cooldown window or the global hourly cap may need adjustment. See Rate Limiting and Alert History.
Email Notifications Overview – See how the Site Monitor handles every error type, not just OOM, and how rate limiting keeps your inbox from flooding during a crash storm.
Setting Up Notifications – Configure your recipient email, error levels, and rate limits here. WPDT cannot send OOM alerts until this step is complete.
Rate Limiting and Alert History – Understand how WPDT decides when to suppress a duplicate alert, and where to find the 7-day log of everything it sent and skipped.