in reply to Re^2: Out of memory using chart::clicker
in thread Out of memory using chart::clicker

Yes, you are most probably right, since you are calling Chart::Clicker in a sub, what you do there should have lexical scope and allocated memory should be redeemed when you exit the sub as the references to objects fall out of scope. So, I somewhat overlooked part of what you are doing in your program and,as far as I can say, you do not seem to be doing anything wrong. It would appear, then, that the memory leak (if any, but it definitely looks so) probably occurs in the module you are calling or possibly in another module called by it.

The solution (or rather workaround), that I used a couple of times in the past in vaguely similar situations, might be to have your Perl program process, say, a couple of hundred of datasets and then die (using the exec function or maybe forking before dieing or possibly doing it in a shell loop or some other similar means, I just remember I tried various possibilities and I don't remember exactly which one worked, and I can't check the final program before returning to work on Monday) after having called itself with parameters for the next group of datasets, and so on until your are done. This approach is far from being pretty, but, it seems to work.

Update :

Actually, I had not yet seen it when I just wrote the above, but davido said it before me and I can only agree with him: yes, forking and suiciding immediately after seems to be a good solution temporary fix.

Replies are listed 'Best First'.
Re^4: Out of memory using chart::clicker
by Anonymous Monk on Feb 24, 2014 at 19:45 UTC
    yes, I temporarily set dog-nail chartClicker memory leak like
    `perl musub.pl arg1 arg2...`
    in parent perl script.
    The mysub.pl is a command line perl script wich works with $ARGV array. So 'arg' is serialized for command line notation array like
    $arg = join(',',@arg_array)
    witch may be converted back into mysub.pl to array like
    @arg1_array = split(/./,$arg1_scalar)
    for using
    ... values => \@arg_array ...
    for example.

    BUT It's so SLOW working, may be good idea is using '&' in
    `perl musub.pl arg1 arg2... &`
      Sorry for mine anonymous post :)