Re: [CDBI] C::DBI Memory usage
Perrin Harkins <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 2006-05-24 at 13:33 +0100, Aaron Trevena wrote: > I'm assuming that CDBI objects are hash based, and over time the size > of those hashes will grow but none of the objects are in scope for > more than a few minutes and so shouldn't be using memory - are there > any global's that could be grabbing memory over time? If you do a query with a large result set, the entire thing will be loaded into memory. The process will remain that size after the rows go out of scope. It's not an object index thing; it's just how Perl works. One way to avoid this is to do paging with LIMIT clauses or the equivalent for your database. Some databases support fetching rows as you need them, usually using cursors, but keep in mind that the current DBD::Pg doesn't support this: http://search.cpan.org/~dbdpg/DBD-Pg-1.49/Pg.pm#Cursors - Perrin