Joe Tiza

Have you ever been browsing your website and suddenly slammed with a confusing error message? If you see something like “Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 36864 bytes),” it means your WordPress site is having a memory meltdown! Don’t worry, this is a common problem with a simple fix. Let’s break down what’s happening and how to get your site back up and running smoothly.

Imagine your website as a busy office. It needs space to store all its documents (files, images, code) and enough desks (memory) for everyone to work (run plugins, themes). The error message means the office is running out of desk space! There are simply not enough resources for everything to function properly.

Here’s how to be the hero and save the day!

  1. Give Your Office More Desks (Increase the Memory Limit):

    • This is the most common solution. The amount of memory your site can use is often limited by your web hosting provider. There are two ways to increase it:
      • Option A: Be the IT Person (Edit wp-config.php):
        • Warning: This involves a little technical tinkering, but don’t worry, it’s easy! You’ll need to access your website’s files using a program like FileZilla or your web host’s file manager (like a web-based file explorer).
        • Find the wp-config.php file in the main WordPress folder (often called the “root directory”). This file basically holds all the settings for your website.
        • Open the file for editing and add a new line right before the part that says “That’s all, stop editing! Happy blogging.” Here’s what the new line should look like:
          define('WP_MEMORY_LIMIT', '256M');
          

          This code increases the memory limit to 256 Megabytes (MB). You can adjust the value (e.g., ‘128M’ or ‘512M’) depending on your website’s needs.

        • Save the changes and upload the wp-config.php file back to your website.
      • Option B: Ask the Building Manager (Contact Your Web Host):
        • If you’re not comfortable editing files, don’t sweat it! Simply contact your web hosting provider’s support team. They can usually increase the memory limit for you through their control panel.
  2. Identify the Memory Hog (Find Problematic Plugins):

    • If increasing the memory limit doesn’t solve the issue, a specific plugin might be the culprit. Plugins are like different departments in your office – some are small and efficient, while others are big and require a lot of resources. Here’s how to find the memory monster:
      • Become the Detective (Deactivate All Plugins): If you can still access your WordPress admin panel (the dashboard where you manage your site), deactivate all your plugins. If your website suddenly starts working again, then a plugin is likely causing the problem.
      • Catch the Culprit (Reactivate Plugins One by One): One by one, reactivate each plugin and check if the error reappears after reactivating a specific one. This will help you pinpoint the problematic plugin.
      • Consider replacing the memory hog with a similar plugin that uses fewer resources. There might be a more efficient way to do the same job!
  3. Declutter the Office (Optimize Images):

    • Large image files can be like those overflowing filing cabinets – they take up a lot of space! Here are some ways to make your images leaner:
      • Use a plugin like Smush or EWWW Image Optimizer to automatically compress images before uploading them to your website. Think of it like using a space-saving organizer for your files.
      • Resize images before uploading them. There are free tools online that can help you do this quickly and easily.
  4. Clean Up Unused Equipment (Delete Inactive Themes and Plugins):

    • Get rid of any themes and plugins you’re not using anymore. Even if they’re inactive, they can still be using up memory space in your website’s office.

Bonus Tips:

  • After making any changes, visit your website to see if the error is fixed.
  • Start by increasing the memory limit in small increments (e.g., 128MB) and raise it gradually if necessary. You don’t want to give your office more space than it actually needs.
  • Consider using a plugin like Query Monitor