in reply to Out of memory using chart::clicker
mysub will create 10000 objects, which should not be a problem so long as the objects have only a few hundreds of numerical data. But if your module stores also the generated graph, then you might be creating objects that are 100 kB large (or more). And then, you might run into a problem if the created objects are persistent and not released between two calls. I would suggest that you try to let each dataset fall out of scope between two calls. This way, presumably, Perl will release the memory each time and you should not have any trouble.for (my $x=0;$x<10000;$x++) { &mysub(\@x_axis, \@{$a_hash{abc}}); print "."; }
Passing lexical copies of the arrays, rather than the references, might be the way to go.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Out of memory using chart::clicker
by Peterpion (Acolyte) on Feb 21, 2014 at 13:55 UTC | |
by Laurent_R (Canon) on Feb 21, 2014 at 21:39 UTC | |
by Anonymous Monk on Feb 24, 2014 at 19:45 UTC | |
by BorisPlus (Initiate) on Feb 24, 2014 at 19:49 UTC |