I am using hash reference to pass between function.
Although I use delete, assing to void =(), and try all
of them in the function in which I receive the reference
the memory does seem to get freed up. Is there some
way of explicity telling the interpreter to forcibly
free what is really free?
Or does the hash reference needs to freed in a different
way?
sample code snapshot:
sub f2 {
my $ht_ref = shift;
my %ht = %$ht_ref;
print "some val = ", $ht{1}, "\n";
%ht=();
undef %ht;
}
sub f1 {
my %ht=();
my $i;
for ($i=0; $i<0xfffff; $i++) {
$ht{$i} = $i;
}
f2 (\%ht);
%ht=();
undef %ht;
}
f1();
while (1) {
# sleep here and monitor the memory. memory
# does'nt seem to come down :((
sleep (5);
}
thanks,
-sureshr
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.