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 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'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.

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.

- Perrin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.