perlquestion
asinghvi
Perl gurus,<br>
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.<br>
I have the following code:
<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;
</code>
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.<br>
Am I missing something here<br><br>
Thanks in advance for your help<br>
-A