Re: Re: DB getAll method has memory leaks

From: Date: Fri, 27 Sep 2002 17:26:57 +0000
Subject: Re: Re: DB getAll method has memory leaks
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-9623@lists.php.net to get a copy of this message
On Fri Sep 27, 2002 at 10:0447AM -0700, Jason Rust wrote: > >2. In mysql.php in the simpleQuery method (which getAll uses) there is > >this bit of code: > >if (is_resource($result)) { > > $numrows = $this->numrows($result); > > if (is_object($numrows)) { > > return $numrows; > > } > > $this->num_rows[$result] = $numrows; > > Here is my suggested patch for this problem. Instead of making num_rows > an array just make it a regular variable. That way it doesn't get > bigger as more queries are performed and it is easier to access the > number of rows from your last query because you don't need to know the > $result id to know which element of the array to access. I guess Stig had a good reason for making this an array and it isn't a good idea perhaps to make it a scalar now. -- - Martin Martin Jansen http://martinjansen.com/

« previous php.pear.dev (#9623) next »