XP is just a number | |
PerlMonks |
Re: Avoiding memory loss...by LanX (Saint) |
on Dec 27, 2012 at 21:53 UTC ( [id://1010586]=note: print w/replies, xml ) | Need Help?? |
Hi first, you don't need to intialize an array, perl does the allocation automatically when you do the push.
> and, periodically wanting to delete the hash.
depends, garbage collections cleans up variables with an empty reference count. so as long as you don't have any $copies = $Table{$cID} somewhere else in the code the hash will be automatically destroyed when deleting the last reference. The same for all nested substructures/elements like the array $Table{$cID}{raw}, if there are no other references they will be destroyed, too. in other words: no reference left <=> no memory used for details see: perlref Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|