[Dbix-class] Memory usage, something hanging on?

Toby Corkindale tjc at wintrmute.net
Mon Jan 8 17:52:03 GMT 2007


On Mon, Jan 08, 2007 at 04:59:20PM +0000, Matt S Trout wrote:
> On 8 Jan 2007, at 15:51, Adam Sjøgren wrote:
> 
> >  Hi.
> >
> >
> >In a Catalyst application I am working on, in which we use
> >DBIx::Class, server.pl just grew to use over 300MB ram, staying that
> >size from then on.
> >
[snip]
> >
> >What happens is that the memory usage grows to ~250MB when ->search()
> >is called. This, I sort of expected.
> >
> >But when do_search() returns, the memory is still in use. The only way
> >I can make it not be so, is by terminating the script or calling
> >$schema->storage->disconnect. I would guess the memory should be freed
> >when $xs goes out of scope(-ish)?
> DBD::Pg doesn't use cursors, it fetches the entire data into local  
> memory. DBIx::Class uses prepare_cached to get the $sth.
> 
> So, I believe what you're seeing is DBD::Pg fetching the full dataset  
> and not releasing it until the $sth is re-executed by the next search.
> 
> Try forcing the $dbh to disconnect at the end of do_search and see if  
> that drops the memory.

Also, check $sth->finish;

tjc

-- 
Turning and turning in the widening gyre/The falcon cannot hear the falconer;
Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world
(gpg --recv-key B1CCF88E)



More information about the Dbix-class mailing list