in reply to Re: Abnormal memory in some modules
in thread Abnormal memory in some modules

Thanks for your enlightenment. I've been playing with perl -Dm compiled with -DDEBUGGING but I don't know yet how to make sense of the address it prints, or how do they map to perl data structures.
0x81cdb38: (01225) malloc 28 bytes 0x81cf880: (01226) malloc 28 bytes 0x81cdb58: (01227) malloc 40 bytes 0x81ce210: (01228) malloc 16 bytes 0x81c2560: (01229) free
Also I've found that the offending modules, although the objects I create inside the loop, are scoped inside the loop, so the object should be destroyed each loop iteration, as it happens with my test modules:
new Test DESTROY Test new Test DESTROY Test new Test
I have found the problem in Mail::Audit. It was a circular reference:
# $self->{obj} = $self; # backwards-compatibility for everyone who d +esperately needed access to $self
Taking that line out solves the problem. I'll send a notice to the author. Your insight has been very useful. Thanks.

Replies are listed 'Best First'.
Re^3: Abnormal memory in some modules
by tilly (Archbishop) on Aug 17, 2004 at 15:46 UTC
    In Mail::Audit you should not remove the line, instead if you're on Perl 5.6 or better, it should use WeakRef's weaken (shipped in the core of Perl from 5.6 on) to fix the reference counting.

    As for Devel::Leak, it may well use an internal data structure for this. If you're curious, peaking at sourcecode is helpful. In any case the problem is that Devel::Leak::NoteSV should clean up the results of having being called before if it is called again. If you can't puzzle out from the code how you might do this, the bug description you started with is specific enough for the author to probably figure it out.

    But just in case, it never hurts to attach a complete description of your environment to a bug report just in case it matters. perl -V will give you such a description.