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

Kevin Esteb kesteb at wsipc.org
Mon Jan 8 18:44:54 GMT 2007


I have noticed this same behavior using Class::DBI with Postgres.
  

-----Original Message-----
From: Toby Corkindale [mailto:tjc at wintrmute.net] 
Sent: Monday, January 08, 2007 9:52 AM
To: dbix-class at lists.rawmode.org
Subject: Re: [Dbix-class] Memory usage, something hanging on?

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)

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/dbix-class@lists.rawmode.org/



More information about the Dbix-class mailing list