ZF-5959: Picasa extension uses memory like it's going out of style
Description
Currently, the picasa extension takes 18MB of memory to parse an album with only 31 photos in it.
The below script reports 18846720 bytes of memory used for me. (This is right out of the developers guide)
<?php require_once 'Zend/Loader.php'; Zend_Loader::loadClass('Zend_Gdata_Photos'); Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); Zend_Loader::loadClass('Zend_Gdata_AuthSub'); //$serviceName = Zend_Gdata_Photos::AUTH_SERVICE_NAME; //$user = "username"; //$pass = "password"; //$client = Zend_Gdata_ClientLogin::getHttpClient($user,$pass,$serviceName); $gp = new Zend_Gdata_Photos(); try { $query = $gp->newAlbumQuery(); $query->setUser("stephliu"); $query->setAlbumId( "5257496817114515249" ); $albumFeed = $gp->getAlbumFeed($query); foreach ($albumFeed as $albumEntry) { if ($albumEntry->getMediaGroup()->getContent() != null){ $url = $albumEntry->getMediaGroup()->getContent(); $url = $url[0]->getUrl(); print $url . "\n"; } } } catch (Zend_Gdata_App_HttpException $e) { echo "Error: " . $e->getMessage() . "\n"; if ($e->getResponse() != null) { echo "Body:
\n" . $e->getResponse()->getBody() . "
\n"; } echo "Request:
\n" . $e->getRequest() . "
\n"; } catch (Zend_Gdata_App_Exception $e) { echo "Error: " . $e->getMessage() . "
\n"; } catch( Zend_Uri_Exception $e){ echo $e; } echo memory_get_peak_usage(); ?>
Comments
Posted by Jeff Fisher (jfisher) on 2009-03-06T11:37:50.000+0000
For reference, retrieving a feed with a single entry uses 9197384 or about 9MB of memory.
Posted by Mike Willbanks (digitalstruct) on 2009-06-24T22:00:33.000+0000
This is likely due to the usage of DOM XML which has to parse the full feed which I believe would be up to the package maintainer to really rework this from the current requirements standpoint. Maybe an option to state the parser that should be utilized could be added?
Posted by Shaun Farrell (farrelley) on 2010-03-03T03:21:30.000+0000
I am having this same issue on Gdata_Youtube when I grab a users uploaded videos. My method that loops through the VideoFeed uses lots of memory. Increments of 10megs. I'm pretty sure it has to do the $videoFeed->getNextFeed();
Posted by Adam Lundrigan (adamlundrigan) on 2012-05-17T18:58:02.000+0000
Reclassified (Performance Improvement, Major)