I seem to often hit the wall with regard to the amount of memory my Drupal site can handle. It seems that when I add a module when I am close to the max memory, the system chokes and won't let me into admin/modules/. Removing the module I just uploaded consistantly fixes the problem and gets me back to where I was.

This is the type of error I get:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 3840 bytes) in /home/webusers/mdowsett/dowsett.ca/events/modules/rsvp.module on line 117

I have paired down all the unneeded modules from my site but now I have hit the wall again. There are so many more modules I want and need to add but I don't know how to adjust my allowed memory.

I fear my problem is that I don't own the server the site is on and I hope I don't run into a problem with trying to get my ISP to give me more memory...if that is what I need.

Any advice?

CommentFileSizeAuthor
#16 memory.diff.txt576 bytesbeginner

Comments

killes@www.drop.org’s picture

Yes, you will need to ask your provider to allow PHP to use more than 8MB of memory. On the admin/modules page Drupal loads all available modules.

nsk’s picture

If you can code in PHP, You can configure Drupal to maximise the allowed memory automatically at start-up. You can edit your php.ini to maximise it by yourself.

mdowsett’s picture

how much should I ask them to up the memory to? I have about 40 modules active now and the last main one I want to add is the ecommerce one which I am sure is a larger module to use.

What eats up the memory (I am a PHP novice) the modules or the tables? And once the tables get populated with data from use, does that make it grow a lot?

Thanks for the advice.

killes@www.drop.org’s picture

12 or better 16 MB have been recommended. That amount of memory is actually only needed on the admin/modules page. it does not depend on the size of the SQL tables, but more modules == more memory.

mdowsett’s picture

the ISP said they can't bump up the memory since it is a shared server...something about system stability.

They said I will have to optimize my code better. i have already paired out the modules I won't use....so now what can I do? I can't beleive I am out of memory as i have just gotten finished adding all the modules (except for ecommerce) that were n my wishlist.

Would the tables also take up that memory? Cuz I have added some modules and their related tables but haven't deleted the tables after I deleted the modules (that scares me...I don't want to delete the wrong tables).

mdowsett’s picture

nsk...you said

" If you can code in PHP, You can configure Drupal to maximise the allowed memory automatically at start-up. You can edit your php.ini to maximise it by yourself."

I don't know how to code....but is it easy enough for you to walk me thru it? ...or how easy is it for someone else to look at the php.ini to maximize it.

killes@www.drop.org’s picture

Well, yes, we are discussing to optimise Drupal for memory footprint. Come back at Drupal 4.7 ;).
The tables don't matter for php memory. They take up discspace though (not much).

In short : If your hoster cannot give you higher memory limits you either need to use less modules or change hosters.

mdowsett’s picture

damn! I was afraid you were going to say that. I changed hosting companies once already because the last one had an old version of MySQL on their server that wouldn't allow Drupal to run. I didn't know to ask about PHP memory requirements on this new one. It's such a pain to move hosting companies...

I should have known...you get what you pay for...they were cheap.

What about if have another subdomain on that domain...would that get me another 8MB of PHP memory so to speak? ie. I would have my main site on one subdomain (site.mydomain.com) and then have my ecommcerce stuff on another (store.mydomain.com)?

Just grasping for hope...

killes@www.drop.org’s picture

Page requests to your subdomain would be treated as separate page requests and have the same 8MB limit. But since you will have the same basis modules (and maybe soem more) this is not what I'd call a viable solution.

nsk’s picture

If the company doesnt accept to change he memory limit, I would suggest you to change webhost and find one which offers VPS/VDS capability. I personally use this and I am happy.

Anonymous’s picture

mdowsett’s picture

A knowldgable PHP devloper told me to put this as the second line in my index.php file:

ini_set("memory_limit","20M");

And this seems to have solved any of my memory issues. Keep in mind that I couldn't adjust the amount of memory PHP is to use on the server since it is at my hosting company.

...whatever works!

beginner’s picture

Version: » 4.6.2
Category: support » bug
Status: Closed (fixed) » Active

The problem still exists with 4.6.2.
The problem occurs when loading admin/modules

I found a fix that works for now: in .htaccess, add the following line:

php_value memory_limit 16M

But the pages still loads slowly (better than not at all...).
Since it seems that many drupalers run into this problem, it may be judicious to add that line by default in .htaccess.

Certainly, there would be a better long term solution.

Killes speaks about a fix in 4.7?

B.

mr700’s picture

Is it possible to split the modules in two parts - one needed by the administrative interface which will eat much less memory and one for the normal work which will eat a bit less memory also? Just a thought...

bertboerland’s picture

Title: Out of memory » as per DrupalCON
Category: bug » feature

this is filled as a feature request instead of a bug. the workaround is simple (when one has access to the settings). no need to ship drupal core with a higher memory setting (yet?)

beginner’s picture

Title: as per DrupalCON » Set higher default php_value memory_limit in .htaccess?
Version: 4.6.2 » x.y.z
Component: module system » base system
StatusFileSize
new576 bytes

What about adding a higher memory default in .htaccess?
If needed, the line can be commented out, with a note somewhere in INSTALL.txt about it.

In my experience, I need to add this for every Drupal site I have (including 4.7), so it'd be nice to have it by default.

I just rerolled the split mode patch that can solve this problem, too:
http://drupal.org/node/35657

beginner’s picture

Status: Active » Needs review
dries’s picture

Status: Needs review » Closed (won't fix)

Hopefully, the theme system changes and the directory reorganization will fix these problems.

DarrenZai’s picture

Version: x.y.z » 6.9

My host doesn't load php as a module so the change in .htacess didn't work, but putting this line in the index.php seems to fix the problem. I also had to add it to the upgrade.php to finish the process. Thanks for this.