Hi all,

OpenCA especially the batch mechanism has problems with memory leaks. Chris performs several tests to find out this and I searched for several months to find the reason. Last weekend I ahd an idea and now I have a small demo script:

####################################################
use Apache::Leak;
leak_test
{
    $return = go ();
};

sub go
{
    my %rest = undef;
    $rest{test} = "123";
    ## go_1 (\%rest);
    ## undef %rest;
    go_1 (\%rest);
    undef %rest;
}

sub go_1
{
    my $self = shift;
    return $self;
}
###################################################

The interesting stuff is the function go. You can test the function with passing %rest as hash and a reference and you can use undef %rest or you can remove it. The interesting thing is that if yoou pass %rest as reference then the garbage collection of perl does not work and you have to undef %rest explicitly. We widely use this in OpenCA::DBI and sometimes indirectly with the crypto stuff.

To the developers, if you use references as parameters then be really careful with the destruction of the references - out of scope means not out of memory.

Michael
--
_______________________________________________________________

Michael Bell                    Humboldt-Universitaet zu Berlin

Tel.: +49 (0)30-2093 2482       ZE Computer- und Medienservice
Fax:  +49 (0)30-2093 2704       Unter den Linden 6
[EMAIL PROTECTED]   D-10099 Berlin
_______________________________________________________________


------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click _______________________________________________ OpenCA-Devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/openca-devel

Reply via email to