On Tue, 22 Jul 2003, Justin Mason wrote:

> Nik Conwell writes:
> >Just curious why you didn't implement code to walk the breadth of the namespace
> >of the object and delete every member variable?  Performance issues?
>
> Hmm, never occurred to me ;)  That would be a worth a try.


Sorry, I've got to bail on this because of other projects, but here's what I
have so far in case it's helpful.


A small test program to recreate the problem.  I can send to the list if
appropriate or you if you want.

I've instrumented all objects in SA (new method and added DESTROY method) to
display the address of the object.  I've verified that during a test run, all SA
objects that get created by new do indeed go through DESTROY (each iteration,
not at exit time) so Perl does think it's removing the object and it's not a
case of circular references being left over.

   Basically I added into sub new on each package:

    warn "Creating " . $self;
    my $foobar = sprintf("$self");
    ($foobar) = ($foobar =~ /(0x[^\)]+)\)/);
    $main::created{$foobar} = 1;

  and created for each package:

    sub DESTROY {
      my $self = shift;
      warn "Destroying $self";
      my $foobar = sprintf("$self");
      ($foobar) = ($foobar =~ /(0x[^\)]+)\)/);
      delete $main::created{$foobar};
    }

The leak in my test program was about 1.5K per creation/check, and seemed to be
constant regardless of size of data being run through SA.


Just for fun, I implemented test code to walk the namespace of the object and
explicitly delete member variables.  It didn't help, but here's what I was
doing:

    my $status = $spamtest->check($mail);

    my $varname;
    foreach $varname (keys %$status) {
        if (ref ($status->{$varname})) {
            $verbose and print "\$status->{$varname} is a reference to 
$status->{$varname}\n";
        }
        delete $status->{$varname};
    }

(I also did this for the NoMailAudit object, but that didn't help either.)

I'm leaning towards this problem being a Perl memory leak, so my next step would
have been to isolate the object creation/deletion to a small test program and
then to present that to the Perl authorities.  Unfortunately due to time
constraints on other projects I can't get to this.  Instead I'll probably get
around things by calling SA in a fork().

FYI - mailscanner (which uses SA as a factory) restarts itself every 4 hours...


Thanks for creating/maintaining SA.  It is most cool.

-nik


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to