On Tue, 13 Apr 2010 16:25:32 +0100, Patrick Dupre wrote:
> I have the a hash of hash of ... of array (see below hwo I can list it)
> whose i wish to free the memory at one point. Right now the
> desallocation is not clean, ie that evert time that I reallocate the
> hash, the programme requires more and mor space and finally swap the
> memory !
> How can I free the mempry right. I already tried several trivial thing
> without success:
>
> Thank for your help.
>
> foreach my $sig (sort keys %$trans) {
> foreach my $vt_u (sort keys %{$$trans {$sig}}) {
> foreach my $Nu (sort keys %{$$trans {$sig}{$vt_u}}) {
> foreach my $ku (sort keys %{$$trans {$sig}{$vt_u}{$Nu}}) {
> foreach my $vt_l (sort keys %{$$trans {$sig}{$vt_u}{$Nu}{$ku}})
> {
> foreach my $Nl (sort keys %{$$trans {$sig}{$vt_u}{$Nu}{$ku}
{$vt_l}})
> {
> foreach my $kl (sort keys %{$$trans
> {$sig}{$vt_u}{$Nu}{$ku}{$vt_l}{$Nl}}) {
> print "$sig, $vt_u, $Nu, $ku, $vt_l, $Nl, $kl: ", $$trans
> {$sig}{$vt_u}{$Nu}{$ku}{$vt_l}{$Nl}{$kl} [0], " ", $$trans
> {$sig}{$vt_u}{$Nu}{$ku}{$vt_l}{$Nl}{$kl} [1], "\n" ; }
> }
> }
> }
> }
> }
> }
*Rubs eyes*
Can you put this stuff in a relational database, say sqlite? What you
have above is pretty hard to maintain and if you have enough entries that
memory is a problem then I think you have two reasons already for
migrating to a database.
--
Peter Scott
http://www.perlmedic.com/ http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274
http://www.oreillyschool.com/courses/perl1/
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/