• Resolved stalik

    (@stalik)


    Dear all,

    I am constantly getting from time to time this error:

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in /home/…/public_html/wp-includes/wp-db.php on line 1978

    I went to check this line 1978 but there is no parameter for memory there.

    I also searched this forum and I see other people had the problem too, but the first 10 topics (of tens!) that I checked and the answers given there we more than 4 years old. (Maybe search options here need to be improved…)

    So previous answers were useless for me. I checked wp-setting.php and wp-config.php – no content concerning memory size there.

    So please, help me.

    Thanks in advance!

Viewing 14 replies - 1 through 14 (of 14 total)
  • You could try increasing your available memory to 256MB in the wp-config.php file (take a backup copy first):
    http://codex.ww.wp.xz.cn/Editing_wpconfig.php#Increasing_memory_allocated_to_PHP

    This may or may not work depending on how much memory your host allocates.

    You could also install a plugin to check if any of your plugins are using excessive memory:
    https://ww.wp.xz.cn/plugins/p3-profiler/faq/
    https://ww.wp.xz.cn/plugins/wp-memory-usage/

    Thread Starter stalik

    (@stalik)

    The first link you are giving me sais:

    There is currently no text in this page. You can search for this page title in other pages, or search the related logs, but you do not have permission to create this page.

    Thread Starter stalik

    (@stalik)

    Thank you!

    As far as I understand I need to add define( 'WP_MAX_MEMORY_LIMIT', '256M' ); in wp-settings.php, right?

    No problem. Yes that is the correct code to add on a new line in your wp-config.php file – NOT your wp-settings.php file.
    Again, create a backup of the file before making any changes.

    Thread Starter stalik

    (@stalik)

    OK, I put it in wp-config.php before the wp-settings.php line and the problem endures. So now I guess I have to drop a ticket to my hosting provider asking them how much memory do they allocate, right? Or I can check/modify that by myself?
    (Sorry for these questions – lay person here…)

    You can check to see how much memory you are allocated by installing:
    https://ww.wp.xz.cn/plugins/wp-memory-usage/

    Then, you can delete that and add the p3 profiler plugin to see which plugins are using the most memory. If your host refuses, or is unable to increase your memory allocation, you could explore alternative plugins which have a lower memory requirement.

    Thread Starter stalik

    (@stalik)

    Strange. This plugin sais Memory : 66.74 of 128. And P3 sais 69.69 MB avg. memory usage. So I am confused now. Does it mean that the problem for sure lies in the hosting?

    I would delay getting in touch with your hosts and keep the p3-profiler activated for a day or two. It may be that one of your plugins is idling now, but when it is active it drains your available memory. The average memory usage over 48 hours might show this more clearly. What plugins do you have installed, and do any have a history of being memory hungry? If you have access to your cPanel, then you could also keep an eye on your Resource Usage to see whether your memory peaks coincide with anything you have scheduled such as security scans.

    Thread Starter stalik

    (@stalik)

    My CPanel data:

    I have 25 plugins. I can give a list if needed. I guess the most resourceful among them is iThemes Security (but it is just a guess).

    Your memory resources profile doesn’t look too worrying. I’ve now realised that the p3-profiler doesn’t log an average usage over a 24 or 48 hour period, but just the average for each scan you make – so evaluating things over an extended period probably won’t make too much of a difference.

    25 plugins could be stretching your memory limit at times when several of the plugins are in action simultaneously. Is there any way you could trim down that number? Duplicate functionality or alternatives that combine several functions in one plugin? Maybe posting a list of the plugins you use here here would be useful, as forum users may be able to offer their opinions. Also, perhaps see if your host will increase your memory to 256 mb, as this would be an easier solution than changing plugins and trialing/setting up new unfamiliar ones ones.

    Thread Starter stalik

    (@stalik)

    OK, so I dropped a ticket to my hosting provider and they fixed it. There is some PHP Manager in CPanel through which I can change my PHP version and memory_limit. So now it is fine. Thanks though for the help. Very very much!

    Fantastic news – the easiest solution prevails! In situations like this you can congratulate yourself on choosing a responsive and proactive host. Makes all the difference. Best wishes.

    Thread Starter stalik

    (@stalik)

    Thanks again to you! 🙂

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Fatal error: Allowed memory size exhausted’ is closed to new replies.