|The stupid question is the question not asked|
Memory utilization and hashesby bfdi533 (Friar)
|on Jan 17, 2018 at 20:53 UTC||Need Help??|
bfdi533 has asked for the wisdom of the Perl Monks concerning the following question:
I have some code which reads from a file (sometimes 100+ GB) and has to combine rows to create a consolidated output. I used to process the entire file into a hash and then dump the hash at the end of the program.
The problem with that was, of course, with the very large files, the hash would grow humongous and the program would consume all memory in the system causing it to crash.
So, trying to solve this problem, I changed the code to output the data as it went, doing my best to make sure that I got all of the row data for consolidation and the did a delete on the hash, thinking I was clearing up memory. But, this does not appear to be the case. Example code:
Does delete actually remove the storage from the hash?
Does the memory the hash is using actually get reduced after delete?
Is there a better way to do this?
Code updated above per the first reply.