http://www.perlmonks.org?node_id=333464

asinghvi has asked for the wisdom of the Perl Monks concerning the following question:

Perl gurus,
I am trying to address some memory limitation in my perl program. While doing my research, I was curious to see how memory gets released in perl once a variable goes out of scope.
I have the following code:
#!/usr/bin/perl undef %hash1; foreach ($i=1;$i<=1000;$i++) { foreach ($j=1;$j<=100;$j++) { foreach ($k=1;$k<=100;$k++) { $hash1{"$i^$j^$ik"} = 1; } } } print "Check Memory usage NOW\n"; sleep 10; undef %hash1; print "And Now\n"; sleep 10;
I see that when the data is loaded, the memory of this process is (e.g. 200MB). But after destructing "%hash1", I don't see any change in the perl process/residual memory. Isn't it supposed to reduce the process size of the perl process.
Am I missing something here

Thanks in advance for your help
-A