On 9 Jan 2007, at 14:34, Adam Sjøgren wrote:

On Mon, 8 Jan 2007 16:59:20 +0000, Matt wrote:

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)?
[...]

Sadly, I think I can tell you exactly what this is, and if I'm right
it's nothing we can help you with :(

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.

I guess the search has to be the "same" (for some definition of that)
for the release to happen?

Try forcing the $dbh to disconnect at the end of do_search and see if
that drops the memory.

Calling $schema->storage->disconnect() does release the memory - but
doing that kind of defeats the purpose of the connection pooling,
right?

Yes, but that proves I'm right, at least.

Not surprised finish didn't work since DBIx::Class calls it for you :)

Have a poke around in $dbh->{CACHED_KIDS} or whatever it's called (check the DBI docs, my memory's fuzzy :), you should be able to nuke the appropriate key of that to get the memory back, too.

--
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for Catalyst, DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for details. + Help us build a better perl ORM: http://dbix- class.shadowcatsystems.co.uk/ +



_______________________________________________
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/[email protected]/

Reply via email to