I have a pretty modest drupal site in both terms of size and complexity, I am receiving the following error a lot when trying to delete content:

Fatal error: Allowed memory size of 100663296 bytes exhausted (tried to allocate 28064 bytes) in /home/beathoke/public_html/includes/image.gd.inc on line 190

I know this is to do with the GD image toolkit, I am on shared hosting and this is obviously exceeding the memory limits imposed by the host. What I dont fully understand is that this operation will throw up this error when no other users or guests are using the site, all I'm trying to do is delete content and surely the site is under very little stress resource wise? As you can guess the only suggestion from my webhost is to upgrade to VPS hosting, but is it really necessary to be on a dedicated or VPS server to host a small site with what currently stands at about 100 unique visits per day?


chimpymike’s picture

The error you are seeing is related to the memory_limit setting for php in your php.ini (which you probably don't have access to with your shared hosting account) -- from the error message, it looks like it is set to 96MB but php needs more memory to complete the action.

I'm assuming that you have images attached to the content you are trying to delete -- what is the size of the images?
If they are 1600 x 1200 or larger, you will probably need more than 96MB for image.gd.inc to be able to open / manipulate them.

If you can reduce the size of the images before you upload them and attach them to your content, you should be ok with the 96MB memory limit. If not, you will either need to ask your webhost to increase the php memory_limit setting for your account (and I'm going to guess that they won't), upgrade to a VPS hosting account with your current webhost (which is probably overkill for your site), or look for a new webhost that will give you a higher memory_limit for php on a shared hosting account.

Problue Solutions’s picture

Thanks for the prompt reply.

You are correct, an image is attched to each node of content added. The problem is that the content is added by many different users (gig info with flyer/poster attached), these images will come from many different sources and be different sizes, I dont think simply having a message suggesting to users to use smaller images would work. I've already asked for memory_limit to be increased and got the expected answer :P

Someone suggested using the Imagemagick toolkit instead of GD might help, so I'm using it now and just waiting for the error to appear again (or not hopefully!)

chimpymike’s picture

You are right -- using Imagemagick should solve the problem. If you still want to try and change your php memory_limit, you could also try adding the following to your .htaccess file:

php_value memory_limit 128M

Although most likely this won't work since your webhost probably has a hard limit on the memory_limit value.

If Imagemagick is working for you, then that's probably your best bet.