develooper Front page | perl.beginners | Postings from April 2022

Re: Please help: perl run out of memory

Thread Previous | Thread Next
David Emanuel da Costa Santiago
April 27, 2022 21:05
Re: Please help: perl run out of memory
Message ID:

Às 11:33 de 17/04/22, wilson escreveu:
> hello the experts,
> can you help check my script for how to optimize it?
> currently it was going as "run out of memory".
> $ perl
> Out of memory!
> Killed
> My script:
> use strict;
> my %hash;
> my %stat;

To be honest you don't need the %stat, however you'll need to go through 
the %hash several times for the average calculation. It will also make 
the script more unreadable.

You can also read the file several times, and on each time extract only 
the values of only one item.

The best option is for you to use a profiler to figure it out where the 
most memory is being consumed...

Good luck.

David Santiago

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About