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();
                $jpeg->load($data);
                                
                $exif = $jpeg->getExif();

                if ($exif == null) {
                        $exif = new PelExif();
                        $jpeg->setExif($exif);
                        $tiff = new PelTiff();
                        $exif->setTiff($tiff);
                } else {
                        $tiff = $exif->getTiff();
                }
        } elseif (PelTiff::isValid($data)) {
                //echo "Found TIFF data.<br>";
                $tiff = $file = new PelTiff();
                $tiff->load($data);
        } elseif($verbose)  {
                echo "Unrecognized image format! First 16 bytes: ";
                PelConvert::bytesToDump($data->getBytes(0, 16)); 
                exit(1);
        } 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.
MfG
        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
PEL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pel-devel

Reply via email to