|
Memory-Leak in perl |
Posted by Tobias Reu on Oct-23-2013 16:59 |
|
Hi Peter,
I found a memory-leak in the perl-code:
- in FinanceChart.pm line 106:
$self->setMainChart($self);
- in perlchartdir.pm line 1078 is this method:
sub setMainChart
{
my $ret = eval {
my ($self, $c) = @{perlchartdir::checkarg(\\@_, 2)};
$self->{"mainChart"} = $c;
perlchartdir::callMethod("MultiChart.setMainChart", $self->{"this"}, $c->{"this"});
};
if ((!$ret) && ($@)) { perlchartdir::printerr($@); }
}
$self and $c are the same objects, this leads to and circular reference. I fixed this with an weaken-call:
use Scalar::Util qw (weaken);
weaken($self->{"mainChart"} = $c);
Regards
Tobi |
Re: Memory-Leak in perl |
Posted by Peter Kwan on Oct-24-2013 02:26 |
|
Hi Tobias,
Thanks for reporting this issue to us. This is the same issue described in the following thread. It affects ASP/COM/VB and Perl, which cannot resolve circular references.
http://www.chartdir.com/forum/download_thread.php?site=chartdir&bn=chartdir_support&thread=1377727002
The problem is more series in long running process that can generate many financial charts (such as a desktop application). It can be ignored for short running process that generate only a few charts in each instance (such as a script generating a chart).
The ASP/COM/VB has already been fixed by an updated release (as ASP/COM/VB is usually used as long running processes). We will fix this issue in Perl in the next update.
Regards
Peter Kwan |
|