[CDBI] C::DBI Memory usage

Aaron Trevena aaron.trevena at gmail.com
Wed May 24 17:03:24 BST 2006


On 24/05/06, Perrin Harkins <perrin at elem.com> wrote:
> On Wed, 2006-05-24 at 15:55 +0100, Aaron Trevena wrote:
> > But in that case the process would never need to assign that memory
> > from fresh, it should be able to re-use the memory already allocated
>
> Perl doesn't reclaim memory allocated for one variable for use in
> another.  It keeps the memory there in case that variable gets as big
> again.  You can reclaim the memory with explicit undefs.  However, if
> you really never load large result sets or BLOBs, this is probably not
> the source of your problem.

I thought the memory was reclaimed when the variable goes out of scope.

> > I'm thinking the problem lies in a packaged scoped hash somewhere that
> > is updated frequently and just keeps on grabbing more memory and not
> > returning it. My suspicion is that it's in C::DBI somewhere.
>
> If that's true, Devel::Size will help you find it.  Or try
> Devel::Size::Report and look for anything over a certain size.

Yes, I've tryed these but get totally overwhelmed by the reporting.

> Also, check for other common problems in your code like slurping large
> files or making copies of large variables.  None of that memory gets
> reused for other variables unless you undef things.

I've been checking for a while for anything like that and ruled it out.

A.



More information about the ClassDBI mailing list