On Thu, 20 Dec 2001, Hardy Merrill wrote:

> > A new hash is returned but the old one should get GC'd right?  You
> > are assigning a new hash to $row  and, assuming that, there are no other
> > referances to the old hash it should just go away when $row gets a new
> > ref, or am I missing something?
> 
> I'm curious about this now - it would seem that Rudy is right,
> that when the hashref scalar gets assigned the reference to the
> "new" hash, then the only existing reference to the old hash
> should disappear, which should in theory(?) make the memory
> taken by that old hash available again via garbage collection,
> right?  Why isn't this happening?

I did not get a chance to play with this, but I am guessing that he is
using a dbd that sucks down all of the records on execute and only returns
them to the script when calling fetch* methods.  For these DBs there is
not much of a difference in doing the loop method vs. the fetchall*
method.  Postgres, for one, behaves like this, though you can get around
this by using cursors || by selecting subsets.


-Rudy

Reply via email to