7

I'm currently working with Drupal 7, and I've the following modules installed, all updated to their respective last version:

  • Views - 7.x-3.0-beta3
  • CTools - 7.x-1.0-alpha4
  • Panels - 7.x-3.0-alpha3
  • Rules, ACL, Advanced forum, Forum Access, User Points, BUEditor

I keep getting "PHP Fatal Error: Out of memory." My server's limit is at its maximum allowed by my provider (32 MB). Those errors appears mostly when interacting with the modules page, but it's also appearing for any user who tries renewing his password, or editing nodes.

Thus, would you have any advice on how to lower the memory usage?

P.S.: I've noticed most of those errors include views and views plugins .inc files. But it also concerns .inc files from the core modules and system... I could copy some there if you want me to.

6

There's really not much you can do in this case. Drupal 7 requires fair bit of memory and so do Views, Panels, etc.

If upgrading to a hosting plan where you have at least 128MB is not an option I would at least make sure the following modules are kept disabled:

  • Update Manager
  • Database Logging
  • Field UI
  • Views UI
  • Panels In-Place Editor
  • Any other "UI" module

Do your development locally and use version control & Features to update your production box.

  • 2
    To notice that Views UI is only necessary when editing an existing view, or adding a new view; for the normal usage, Views UI is not necessary, and Views will work normally even when that module is disabled. – kiamlaluno May 28 '11 at 14:03
  • 1
    exactly, the same goes for any of the other "UI" modules. They are only necessary for development. Fields will work without the UI, so will Context, etc.. – Alex Weber May 28 '11 at 15:13
  • 4
    However, views (not UI) itself has currently a huge footprint. I've been working on trying to fight the memory footprint of Drupal recently and noticed views both loads the schema cache and it's own data cache on every page that displays a view. That can easily mean multiple megabytes on a site with a few modules installed (around 4MB on my test install). – Berdir May 28 '11 at 15:53
  • I have to disagree with your recommendation to use features - that module is a huge memory hog. You would be much better of using update hooks to deploy configuration changes. – Felix Eve Mar 2 '17 at 21:59
  • anecdotally, after setting up an existing D7 site on shared hosting and running into many memory issues using views, I've found changing the PHP version from 7 to 5.6 helped greatly. Not sure of the cause, but I had got to the point of allowing 1024M of memory and it was still running out while displaying 16 items in a view. – jammypeach Jun 25 '18 at 12:15
4

As listed in Drupal's System Requirements, Drupal Core itself needs 32M to run. Adding any contributed modules without increasing memory is a surefire way to encounter this error.

If your server's maximum is only 32M, it's time to get new hosting.

  • The bad thing is that I just changed it... I think I'm stuck with it for at least one year...... Gotta check this out. :( – nyoz May 28 '11 at 16:13
  • BTW, my hoster is 1&1 France. I've read in some wordpress support forums that they recently upgraded their php limit to 90Mb. I'll call them on monday...! ;) – nyoz May 29 '11 at 13:42
2

As mentioned, the bottom line is you realistically need 128M. Another point of note is that if you have the image suite working, that frequently reminds us (in Drupal 6 at least) that at least 96M is required in certain circumstances.

32M is just not going to cut it.

0

I think using the Views module is your biggest problem.

Rewrite all pages that use views with custom queries, remove the views module and whilst we are about it also remove Rules (again, move all logic to code) and your memory usage will drop right down.

Also just writing template files and using preprocess hooks will remove the need for Panels saving yet more memory.

These are not easy or quick steps to take and require an intimate knowledge of Drupal, MySql and PHP however if performance is the number one priority this is the best solution (and will run on 32M of memory).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.