alittlebitdifferent has asked for the wisdom of the Perl Monks concerning the following question:
This code eats up memory really quickly. I put about 80,000 arrays into the hash this way. When I debug it I can see the full data set in the Hash and work on it whilsts the program is running However, if I tie the Hash to a DB_File or other db...I seem only able to store the array references on Disk..and my RAM still fills up, storing what I assume is all the array content. I would have thought that if I use undef, the data would be marked as feww in memory again...but al the array content is available...I just can't seem to get it out of RAM and onto disk. Any suggestions on an easy way to move this Hash of Arrays to disk including the array data and avoid eating up RAM?my %bigHash my @Arraybits do this a few times { @Arraybits = ["data","that","is","unique", "for","each","loop"]; my @tmparray = @Arraybits; until (We have done this a few times) { push @{ $bigHash {$Key} }, \@tmparray; #OR push @{ $bigHash {$Key} }, [@tmparray]; } @tmpxmlarray = []; undef (@tmpxmlarray); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash of Arrays - Pushing Array references and memory impacts question
by Marshall (Canon) on Oct 31, 2011 at 16:40 UTC | |
|
Re: Hash of Arrays - Pushing Array references and memory impacts question
by moritz (Cardinal) on Oct 31, 2011 at 15:15 UTC | |
|
Re: Hash of Arrays - Pushing Array references and memory impacts question
by BrowserUk (Patriarch) on Oct 31, 2011 at 15:33 UTC | |
|
Re: Hash of Arrays - Pushing Array references and memory impacts question
by CountZero (Bishop) on Oct 31, 2011 at 21:34 UTC | |
by alittlebitdifferent (Initiate) on Oct 31, 2011 at 23:29 UTC | |
|
Re: Hash of Arrays - Pushing Array references and memory impacts question
by ~~David~~ (Hermit) on Oct 31, 2011 at 16:03 UTC | |
|
Re: Hash of Arrays - Pushing Array references and memory impacts question
by locked_user sundialsvc4 (Abbot) on Nov 01, 2011 at 13:47 UTC |