problems with freeing memory when uploading with gd lib problems with freeing memory when uploading with gd lib
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

problems with freeing memory when uploading with gd lib

Started by gizmen, June 20, 2005, 01:43:01 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gizmen

Hi,

I have recently installed coppermine and i liked it. I configured this gallery to use gd lib. I am running coppermine on freebsd 5.4 with apache 1.3 and php 4.3.11 and newest gd lib.
My problem is that after uploading files to the gallery i checked the apache proceses and i found out that they use quite a lot of memory. so i have restarted apache. And i have added couple big files (2500x1900). I had to increase memory limit to 64M but it was only testing. After uploading one file one of the apache proceses use over 32Mb of memory.
I have uploaded couple more file and apache use enormous amount of memory. I had to restart apache to bring it to normal memory consuption. I dont know where is the problem. I think that maybe gd library doesnt free requested memory or coppermine doesent free memory. I didnt check code of coppermine to find out.
I had to use ImageMagic for image processing. I rater would like to use gd library that ImageMagic but gd is unusable in this moment. After uploading couple big files my server used all physical memory and almost all swap.

Could any one check this

THX

kegobeer

That's expected behavior with GD and ImageMagick.  Image manipulation requires huge amounts of resources.  I posted the formula for how much memory is used.  Basically width x height x color bits (usually 3) = memory required.  You'll find that instead of dying like GD does, ImageMagick will just stop the process but fill up your tmp directory with huge files.  For example, if you attempt to use ImageMagick to resize or watermark an image (3000x2000x3), the process will stop but you'll have around an 84MB file in your tmp directory.  Do a few attempts and you'll run out of disk space really quick.

Resize your images before uploading them, or make your own intermediate images and thumbnails.

If you're running your own webserver (not recommended) you need to set memory limits to prevent exactly what happened to you, for PHP and for ImageMagick.  I recommend reading up on how to administer a webserver.  It will make your life a lot easier.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

gizmen

I know that big resolutions will consume huge amount memory and i am aware of that. But the problem is that after procesing the image gd library does not free allocated memory and apache have it allocated for all the time!!!!!!. After couple big files apache use all my memory. GD (or whatever) should free memory after doing any allocations. But it doesn't. I didn't mention that converting images is working and i have filled my gallery wiht images. But right now GD processing is useles :( Now i am using ImageMagic for processing and it works fine. ImageMagic is litle bit slower that gd but it works without problems. I thing i will stay rather with gallery 1.5 that i have use right now.With coppermine i have stupid problems and i don't have time for that.
I am system administrator for over 6 years and i know apache and php very good so please don't sent me to read any manulas because i did that years ago.