title: How to free memory in Perl?
body: <p>My code looks like:</p>
  
  <pre><code> my %var;
   my %var_new={};
  
   while(1){
       while(my ($k,$v)=each %var){
              &amp;a_sub($v);
       }
       %var={}; # A
       map { $var{$_}=$var_new{$_}; } keys %var_new;
       %var_new={}; # B
   }
  
   sub a_sub { #....} # will fill %var_new
  </code></pre>
  
  <p>My program's memory usage goes up and up.</p>
  
  <p>It seems Perl doesn't free memory at Line A and Line B.</p>
  
  <p>How can I manually make Perl to free up memory used <code>%var</code> and <code>%var_new</code>?</p>