You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2007/05/08 21:37:53 UTC

[Bug 5452] New: Many circular references

http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5452

           Summary: Many circular references
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Libraries
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: dfs@roaringpenguin.com


The SpamAssassin libraries create many, many circular references.  Unless you
are very careful, this could lead to a memory leak.

Example:  Dumping a Mail::SpamAssassin object after a SpamAssassin run reveals
about 233 lines of back-references.

The circular references are used for two purposes as far as I can see:

1) a "main" backreference back to the main SpamAssassin object so plugins can
reach back into it.

2) "performance" backreferences to save typing and time so you don't need to
dereference 4 or 5 hashes and arrays to walk the data structure.

(1) could be solved by passing the main SpamAssassin object around as an
argument to methods and functions that need it.  (2) might be solvable by
limiting the scope of the performance backreferences to "my" variables.

Fixing this will be an awful lot of work.  Maybe we should wait for Perl to have
a proper mark/sweep GC engine. :-)



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5452] Many circular references

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5452





------- Additional Comments From jm@jmason.org  2007-05-09 08:16 -------
yep, perl 5.6.1 is our current minimum.  I didn't realise we could safely weaken
refs with that - can we?



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5452] Many circular references

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5452





------- Additional Comments From msergeant@startechgroup.co.uk  2007-05-09 08:02 -------
There's no reason those links couldn't be weaken()'d - we now require perl 5.6 IIRC?



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5452] Many circular references

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5452





------- Additional Comments From jm@jmason.org  2007-05-09 08:41 -------
http://www.twoshortplanks.com/modulecorelist/index.cgi?module=WeakRef&version=&submit=Lookup
: 'Module WeakRef was never distributed with perl.'

:(



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5452] Many circular references

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5452





------- Additional Comments From msergeant@startechgroup.co.uk  2007-05-09 08:29 -------
http://search.cpan.org/~lukka/WeakRef-0.01/WeakRef.pm

Says it arrived in 5.005_55 (i.e. perl 5.6.0).



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5452] Many circular references

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5452





------- Additional Comments From dmo@roaringpenguin.com  2007-05-09 09:39 -------
(In reply to comment #4)
>
http://www.twoshortplanks.com/modulecorelist/index.cgi?module=WeakRef&version=&submit=Lookup
> : 'Module WeakRef was never distributed with perl.'
> 
> :(

You don't want WeakRef, you want Scalar::Util.

It didn't hit core perl until 5.8, though.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.