Well, as i said before: i want to use PEL to manipulate a LOT of
pictures. Right now I am at a point where it is working smoothly, for a
certain amount of pictures. But there is a memoryleak in PEL.
I noticed that because whenever I tried to use PEL in batch for > 10-20K
pictures, the process will die because it runs out of memory. 1000
pictures manipulated, and PEL ate about 60 mbs of mem, 10K pictures
manipulated, and PEL ate 600mb - and so on. I wasn't able to figure out
what exactly eats that ram and doesn't spit it out. It is one of the PEL
functions within these lines:

$data = new PelDataWindow(iptcembed($iptc_new,$sourcename));
        if (PelJpeg::isValid($data)) {
                //echo "Found JPEG data.<br>";
                $jpeg = $file = new PelJpeg();
                $exif = $jpeg->getExif();

                if ($exif == null) {
                        $exif = new PelExif();
                        $tiff = new PelTiff();
                } else {
                        $tiff = $exif->getTiff();
        } elseif (PelTiff::isValid($data)) {
                //echo "Found TIFF data.<br>";
                $tiff = $file = new PelTiff();
        } elseif($verbose)  {
                echo "Unrecognized image format! First 16 bytes: ";
                PelConvert::bytesToDump($data->getBytes(0, 16)); 
        } else exit(1);
(tried lots of different code - always the same thing)

After lots of testing I found out that this does not happen after every
picture I use PEL with. Only about every 5th time or so, some memory
isnt freed. It has to be inside PEL, as I free *EVERYTHING* else, and
used mem still goes up. 
As I don't have the time at work to fix PEL, I have no way but to
manipulate my pictures in blocks of about 10K pics. That way the
consumed memory goes up to about 600mbs, but at least that still works.
To check memory consumption use something like:
echo "Using ". round(10000 * memory_get_usage()/(1024*1024))/10000 ."MB
of memory.\n";

If you don't have a big fat server to run your PEL-using-PHP on, you
might find out that even 1000 pictures in a row can be a memory problem.
        Jonas Beck

PS: A shame that nobody has time to continue PEL on a regular basis -
being one of the only easily scriptable ways to manipulate EXIF data and
so on. In my opinion there will be even more people who could use PEL in
the next months - most Companies havent really cared about metadata till
now (like the one I work for).

This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
PEL-devel mailing list

Reply via email to