I have just updated a module and went to perform the database update and keep getting an out of memory error, this has happened for some time now for different admin functions.

I have checked two places and both confirm the same:
phpinfo lists memory_limit at 1024M
Drupal Status Report lists php memory limit at 1024M

The eror I am currently getting is:
Fatal error: Out of memory (allocated 158597120) (tried to allocate 71 bytes) in /u/s/sim-one/www.sim-one.ca/includes/menu.inc on line 366

I believe 158597120bytes ~ 158M which is way below my limit. Any suggestions would be greatly appreciated!

Comments

hassebasse’s picture

The last year I have tried to learn Linux, Drupal, WP and Prestashop. By own experience and by reading what other have written I have learned that a too high memory limit may cause problems. What I have uderstood is that the memory_limit settings sets the limit per process and if you set it too high a faulty memory process can bring down the full server. There are actually server providers kicking you out if you set it too high. In the beginning I did as you; the higher the better, but that is not the case. In Drupal you can do fine with 64M or even 32, but I'm using 128M except when I build the site, then I use 512M. I am not sure if 512M is needed, but when building it has been problems with 128M.

So I don't have any answer to your problem, but why not trying to lower the memory_limit and see what will happen, it have helped me at least once.

I use .htaccess instead of php.ini for all settings and below you can see what I use when building my Drupal 7 site. I will lower the memory limit to 128 later on:

php_value memory_limit 512M
php_value max_execution_time 540
php_value max_input_time 300
php_value max_input_vars 1000
php_value post_max_size 100M
php_value upload_max_size 100M

Hans

TimToronto’s picture

Thanks for the suggestion, I just tried it to no avail, and lowering it to 128 caused even most of my admin pages to give me memory errors :(

hassebasse’s picture

Maybe some module is messing it up. Maybe you should turn them off one by one. After having left the comfort zone of Windows, I have became very sceptical towards modules of all kinds. But on the other hand it is big fun when you finally have found out what is the problem.

In your case we can be absolutly sure it is not a matter of a too low value in the memory_limit setting. I deleted the first installation I had done in Drupal beacuse it was messing too much with errors and hanging and so on so I started from the beginning again.

Something that doesn't work well for me is Admin Overlay so I have turned it off.

My suggestion is that you write down when you install a new module so that you can go backwards in that list and turn off modules when you have problems.

Sam Moore’s picture

Can you do free -m at the command line to see if your system RM is getting eaten up?

Can you restart Apache?
That'll dump the PHP memory cache and start you over.
You might want to restart mysql as well.
If you are able to do that, then next thing I'd do is run update.php right away.

In general you're going to want to check your memory allocation to Mysql and Apache and tune the whole setup to make the best use of the RAM you have. Just increasing or decreasing memory allotments without understanding where it's going is probably not going to lead to happiness.

To get deeper into all of this, there are MySQL tuner scripts you can use to check database RAM allocations, and you can use the Devel module to profile your site to see where your PHP RAM is going.