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

Adam Sjøgren adsj at novozymes.com
Tue Jan 9 14:34:43 GMT 2007


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?


  Best regards,

    Adam

-- 
                                                          Adam Sjøgren
                                                    adsj at novozymes.com



More information about the Dbix-class mailing list