[CDBI] C::DBI Memory usage
Matt S Trout
dbix-class at trout.me.uk
Wed May 24 13:42:13 BST 2006
Aaron Trevena wrote:
> Hi All,
> I'm working on scheduling daemon in perl, it uses C::DBI to handle
> DB/Object Persistence, etc as you'd expect.
These days I'd expect DBIC or RDBO, but hey, if you enjoy the legacy
> Unfortunately I'm having issues with the ammount of memory it uses
> after 24 hours of running.
> I've managed to replace the only global and long living objects and
> data structures with array-based objects so I no longer have any
> global or package hashes in the main daemon class - unfortunately it
> uses several CDBI classes (no plugins) and I'm starting to think these
> are gobbling memory.
> 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?
First off, try clearing the LiveObjectIndex every so often. It's almost
certainly not the culprit but it's so easy to try you might as well.
Second, get yourself a copy of Test::Memory::Cycle (and currently
Devel::Cycle 1.04 since 05 and 06 have a slight issue - or look at the
DBIx::Class list for how to tweak a more recent one to work happily) and
start lobbing cycle tests at everything in sight.
> Also has anybody else encountered this problem, or succesfully used
> CDBI in a long-running ( i.e. over 48 hours ) program?
Yes, but it was back around 0.96 and I don't remember if we ever
properly leak-tested it.
More information about the ClassDBI