On Fri, Mar 12, 2004 at 01:02:07PM +0100, Mark Overmeer wrote:
> >
> > Could it be the Mail::Box::Manager object holding references to
> > the Mail::Box objects - I currently just assume $manager->close
> > will cause all remaining references to the folder & thus its memory
> > to be released ? I never hold any references to objects which
> > aren't scoped to a short code block - my code basically looks like:
>
> The situation is a little more complex. The manager holds mailboxes,
> and each mailbox holds messages, and the messages a header and a body.
> Multipart and nested bodys hold list of bodies.
>
> But at the same time, each of these objects refer back to their
> parent, for instance: the body refers to its message. For garbage
> collection to work, the references "back" are weak references
> (see Scalar::Util::weaken()).
>
> In case I have forgotten to weaken one reference, somewhere, some
> parts of the data structure may be kept alive, even after a descruct().
> This is close to impossible to debug...
Just came across the module 'Data::Structure::Util' containing
a useful method 'has_circular_ref' to detect circular references.
I'm going to give it a try to track down the memory problems I'm
having. I've already discovered that they are partly related to
charset decoding, but still processing a 2 MB message should
never required 150 MB of memory (!), no matter what charset it is.
So I think somewhere in the depths of DBI / Encode::compat /
Mail::Box there is some non-optimal memory allocation going on & its
not being released...
Dan.
--
|=- http://www.berrange.com/~dan/gpgkey.txt -=|
|=- berrange@xxxxxxxxxx - Daniel Berrange - dan@xxxxxxxxxxxx -=|
pgpLssancPVQS.pgp
Description: PGP signature
|