mio codice è simile: l'utilizzo della memoriaCome liberare memoria in Perl?
my %var;
my %var_new={};
while(1){
while(my ($k,$v)=each %var){
&a_sub($v);
}
%var={}; # A
map { $var{$_}=$var_new{$_}; } keys %var_new;
%var_new={}; # B
}
sub a_sub { #....} # will fill %var_new
Il mio programma va su e su.
Sembra Perl non memoria libera alla Linea A e Linea B.
Come posso fare manualmente Perl per liberare la memoria utilizzata %var
e %var_new
?
Perché si assegna un hashref a un hash? – Quentin
'usare rigorosamente; usare avvertenze; usa diagnostics' (quest'ultimo solo durante lo sviluppo) – Quentin
Nonostante i bug nel codice che hai postato, non c'è ragione per il codice che hai postato per usare sempre più memoria. – ikegami