Here's the entire error message...

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33532118 bytes) in /home/anxietyz/public_html/blogs/includes/ on line 41

What modules/issues/configurations can cause this error and what are some of the things I can do to correct it?. It periodically happens when I try to login.

I'm running Drupal 6.2 with the following NON-core MODS...

Img comments
Avatar Selection
BUEditor (installed but disabled)
DB Maintenance
LoginToboggan (installed but disabled)
Nice Menus

I have ALL of the default/core modules activated EXCEPT the following...

Content translation
PHP filter

On all of these modules (core and otherwise) I've either used the default settings or configured them to reasonable levels/options.

Thanks so much.

- Regards, Steve


Zahor’s picture

Well the error says you are out of memory. You php.ini settings have allocated 64 MB of memory as the maximum any script can consume - which doesn't seem to be enough. Error also says you need 32 more MB of memory for site to function - I would add 64.

So update php.ini memory_limit to 128 MB

stevenwhite’s picture

Thanks for the quick reply. I asked my host about this and he tells me that I need to create an .htaccess file and change the memory there. Then he sends me to some Apache page with a lot of technical jargon on it. He also tells me that I'm currently set at 96mb,

I guess what I'd really like to do is rather than set a new limit, I'd rather just modify my settings or remove modules so that Drupal does not use so much memory in the first place. Short of that, I'd kind of like to know which of the mods I've listed are memory intensive so that I can disable them.

Any suggestions?

- Regards, Steve

Zahor’s picture

You should install the devel module and display it's block that shows memory usage to see which functions/modules are using the most memory.

stevenwhite’s picture

Thanks for the advice (I'll give it a shot). I set the search index to a much lower number of nodes to index, raised the php memory limit from 96mb to 128mb and deactivated the following mods...

Blog API
Database logging
DB Maintenance

It seems to have done the trick for now but I'm still getting that pesky "auto_increment" error in mysql which is driving me nut and kept me up half the night.

- Regards, Steve

hurz’s picture

I've got the same problem on Drupal 5.7, though I only have a very small number of modules activated:

Image (+assist, attach, gallery, import)
Views, ViewsUI
Poormanscron (!!)

It seems Poormanscron is causing the error, as the site runs flawlessly with it deactivated and Devel shows a memory usage of around 10-11 MB.

My maximum memory is set to 64mb and doing a manual run of cron.php shows:
- Memory used at devel_shutdown(): 60.7 MB
That seems like WAY too much and could explain why Poormanscron is crashing my site when activated (though I set its interval at 60 minutes)
Checking the logs it seems my manual cron run couldn't be completed ... I don't get it ... up until May 4th every run of Cron (even via Poormanscron) completed without problems.

Any ideas?

This is my site by the way:

The memory error is the following:
Fatal error: Allowed memory size of 68157440 bytes exhausted (tried to allocate 54181618 bytes) in /www/htdocs/w0099b51/drupal/includes/ on line 485

I think it's always line 485, which is:
list($split, $result->data) = explode("\r\n\r\n", $response, 2);

VM’s picture

how many nodes on your site?

how large are the tables on your DB, ie: search, watchdog and the like, that cron would be used with ?

hurz’s picture

There's currently 340 nodes (because of the many images) but is that already too much for indexing with 64mb?

The table sizes in the database:
- search dataset (85KB - 330 entries)
- search index (373KB - 7500 entries)
- search dataset (146KB - 3300 entries)
- watchdog (64KB - 215 entries)

DB size is 2.5MB, 61 tables. The biggest table is locales_source (I guess that's my German locale) with 490KB and 3200 entries.

Judging from those values it doesn't really seem like a simple cron run should exceed 64MB ...

VM’s picture

it doesn't really seem like a simple cron run should exceed 64MB ...

Agreed, but because it wasn't mentioned it was worth ruling out as a variable.

hurz’s picture

Well yeah, except it's not ruled out, as cron keeps getting stuck because of too little memory.
Now if the small database doesn't cause that, what could it be ?
Unfourtunately I really can't guess that from the error message ...
Since May 4th when everything was still going well, I also didn't change anything, except adding two simple nodes ...

I tried to run cron.php manually again but I'm always getting stuck with the above error.

max_execution_time is set to 30, would it help to bump that up?
I thought maybe indexing for the search module takes too long, but shutting the module off didn't change a thing.

The really weird thing is that cron.php wants some 50mb more than the provided 65, so it can't really be a problem of growing number of nodes or index size ... so why should cron.php need 120mb while the usually site operations happily run with 10-11mb ?

VM’s picture

I meant ruling out the search table as being overly large and trying to index it.

you can of course bump up the execution time to see if it helps.

Beyond that I have no answer. I've never used poormans cron to know what effect it has on Drupal. I prefer a cronjob set up at the server over what poormanscron does.

I recall reading a few "cron stuck" type threads awhile back. It may help to seek them out.

strship47’s picture

the possibility of something having a duplicate of it's self,
going into a loop that eats up memory. Just a thought

cattle grazing’s picture

Thanks strship47 for this advice. I was continually getting a fatal error and your comment alerted me to the fact that when I had set up an application as a web form I had not deleted the same application I had as a simple page. Both had the same name. Deleted the page version and problem soleved. Thanks again

beto_beto’s picture

I have the same error here
i am new drupal here what i should do

every time i clear the cash this error appear for me !!

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 796289 bytes) in /home/content/q/a/t/qatar123/html/includes/ on line 309

VM’s picture

means you must increase your memory on your server or speak with your host to do it.

ahmedhanyfawzy’s picture

If you are on the shared host and you configured correctly the php.ini for higher memory_limit then the solution is very simple you just need to copy the 'correct' php.ini to the installation folder of drush ; and drush will pick it up by default the next time it run , more details here.

beto_beto’s picture

Thank you

chandraswami’s picture

GoDaddy Linux Server

For some reason, even though I have increased my php memory_limit and my phpinfo.php shows that it has been increased to 128M, Drush cannot recognize this increase and seems to think the memory_limit is still 64M.

When I type, "drush core-requirements" into the puTTY CLI, I receive the message from Drush that the PHP memory_limit is 64M. Also Drush has problems with some functions. Drush is giving me a "Fatal error: Allowed memory size of 67108864 bytes exhausted..."

I have tried creating a php5.ini file and placing it in various Drush folder locations, but this does not seem to do anything.

The link in your post of 2012 is no longer there. Any advice you can give me would be appreciated.

Rajesh Ashok’s picture

Use Xdebugger to trace what is the reason for memory leakage.

chandraswami’s picture

A tech-support person at GoDaddy found an obscure post about this Drush-Memory-Over issue. The link is here .

Essentially Drush has its own ini called "drushrc.php". This little goodie sets the defaults for Drush. The above post requires:

  1. That you find the "example.drushrc.php" file
  2. Add the following text: "ini_set('memory_limit', '128M');" (minus outer double quotes) to the bottom line of "example.drushrc.php"
  3. Rename "example.drushrc.php" to "drushrc.php"
  4. Then place this file in your Drupal root Folder.

The "example.drushrc.php" file is in your Drush installation directory, in my case: "/home/{user-name}/public_html/.composer/vendor/drush/drush/examples" Directory.

Amazing but after so much thrashing around, this finally solved the issue.