Hi, We have some tips to reduce memory usage, one is exactly to use custom queries, but anything has a big impact on used memory: the arch of your server. 32 bits servers use less memory in action. We had a big problem too when processing a large number of object (about 300 000 object from a schema to insert in another, about 1 200 000 insertions), we resolved this by processing items 1000 per 1000, and also by freeing memory by hand. Disabling object pooling had no effect on our app, so the really useful thing to do when you don't need a proprl object anymore is: $object->clearAllReferences(); unset($object);
But you may have to look in your templates too, in order to avoid partials, and look for optimizations. On 3 avr, 10:58, Gareth McCumskey <[email protected]> wrote: > One way to optimize your query is to not use the doSelect method on a Propel > model class but rather the doSelectRS method. doSelect in effect does a > SELECT * on your database whereas with a doSelectRS you can specify exactly > only those columns you want returned and it is returned in a non-hydrated > fashion. > > Of course thats Propel1.2. If you are using Propel 1.3 then instead of > doSelectRS you would need to use a doSelectStmt. The syntax of each is > different but they are essentially the same thing, returning a resultset to > you instead of an array of hydrated objects, with only the exact columns you > want and therefore is far more memory efficient. > > eg: > > $c = new Criteria(); > $c->clearSelectColumns(); > $c->addSelectColumns(MyModelPeer::COLUMN_NAME); > $results = MyModelPeer::doSelectRS($c); > > Gareth > > On Fri, Apr 3, 2009 at 10:45 AM, Lee Bolding <[email protected]> wrote: > > > That's 50MB, which seems more than enough to me - typically, my max > > ram is set to 32MB. > > > The error would suggest you are retrieving far too many objects in a > > DB query and/or that they are far too big. > > > Investigate optimising your query, lazy loading and database > > normalisation > > > On 3 Apr 2009, at 03:03, xhe wrote: > > > > I am using shared hosting, but my backend can not be used due to > > > memory inefficiency: > > > > Fatal error: Out of memory (allocated 51380224) (tried to allocate > > > 7680 bytes) in /home1/transla1/public_html/symfony-clb/lib/model/om/ > > > BaseUserColorEyePeer.php on line 80 > > > > are there anyway to reduce the memory usage? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
