Re: Dreadful DB memory leak

From: Date: Wed, 03 Jul 2002 20:10:05 +0000
Subject: Re: Dreadful DB memory leak
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-1804@lists.php.net to get a copy of this message
Hi Sam, Could you submit a bug request for this one with some example code too? - Stig On Wed, 2002-07-03 at 10:42, Sam Liddicott wrote: > $result=$this->db->query($sql,$values); > > makes use of "prepare" internally and doesn't free the results. > > I have a script which makes hundreds of thousands of dynamically generated > queries and is using upwards of 700M and I'm trying to find out why. > > The leakiness of ->query() is the first thing I spotted. > > Perhaps we could maintain to "prepare" caches, one indexed the actual sql > template so when the same query does end up being prepared it uses a > previous one; but it would be better NOT to keep a cache of statements which > are not explicitly prepare'd in the users own code. > > [a while later] OK, I found out why, I the objects created from the queries > were making a copy (instead of reference) to the "db" object, and each copy > was bigger than the previous copy because of all this unnesseccary caching. > > So the main bug is my fault, but I still think pear shouldn't retain > multiple cached copies of internally prepared ->query() statements. > > Sam > _____ > > > Samuel Liddicott > Support Consultant > sam@ananova.com <mailto:sam@ananova.com> > Direct Dial: +44 (0)113 367 4523 > Fax: +44 (0)113 367 4680 > Switchboard: +44 (0)113 367 4600 > > Ananova Limited > Marshall Mill > Marshall Street > Leeds > LS11 9YJ > > http://www.ananova.com > > Registered Office: > St James Court > Great Park Road > Almondsbury Park > Bradley Stoke > Bristol BS32 4QJ > Registered in England No.2858918 > > The information transmitted is intended only for the person or entity to > which it is addressed and may contain confidential and/or privileged > material. Any review, retransmission, dissemination or other use of, or > taking of any action in reliance upon, this information by persons or > entities other than the intended recipient is prohibited. If you receive > this in error, please contact the sender and delete the material from any > computer. > > > > > -- Stig Sæther Bakken, Fast Search & Transfer ASA, Trondheim, Norway http://pear.php.net/wishlist.php/ssb

« previous php.pear.general (#1804) next »