---
title: "Troubleshooting the error \"Allowed memory size of X bytes exhausted\""
date: "2025-02-06T01:25:19+00:00"
summary:
image:
type: "article"
url: "/acquia-cloud-platform/help/92556-troubleshooting-error-allowed-memory-size-x-bytes-exhausted"
id: "2f06aa5b-c023-4e37-bd36-c3662527144c"
---

Issue
-----

When accessing some pages on your site, running a Drush command on the server or in a cron job, you might face this error:

    [09-Jul-2019 07:03:27 Europe/Paris] PHP Fatal error:  Allowed memory size of XXXXXXXX bytes exhausted (tried to allocate XXXXX bytes) in /full/path/to/module/page.php on line 2703 request_id="v-0000zzzz-a1b2-0000-c3d4-2703zzd0907"

This is usually due to PHP or Drupal not having enough resources to make the request. This means the global PHP memory limit is too low for a site which has overall higher complexity/rendering needs than a standard page.

As explained in the documentation "[Conditionally increasing memory limits](/node/92621)", some pages on your Drupal website (such as admin pages or reports) can require additional resources to run. Increasing these resources globally can decrease your website's overall performance.

Resolution
----------

As a short-term workaround, you can either:

*   Raise the overall available memory on your environment via the Cloud UI (see [Configuring PHP memory limit](/node/56299)). 
    *   If you are running on [Cloud Platform](/node/55808), you can increase the available memory in this way.
    *   However, if you are running on [Cloud Classic](/node/55808) architecture, this can lower the available concurrent requests your site can handle.
*   Add a snippet in your `settings.php` that will allocate additional memory resources for a specific path or URL, or for Drush runs. Those snippets are listed in this documentation: "[Conditionally increasing memory limits](/node/92621)".

Longer-term, you should learn more about how your site uses PHP memory, and make adjustments appropriately. We recommend reading through this article: [How to investigate Memory Consumption problems](/node/92081).

In summary:

*   Find the regular memory consumption of your site. Usually "light" pages would use between 10-30MB of memory on the server. See if you have some sections (like the homepage, Search pages, or Views) that use up more memory.
*   To optimize memory-heavy sections, ask yourself if you can, for example: render less content, or show fewer items/blocks.

See the article [How to investigate Memory Consumption problems](/node/92081) for more.