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

For reference, retrieving a feed with a single entry uses 9197384 or about 9MB of memory.

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?

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();

Reclassified (Performance Improvement, Major)