in reply to Re^5: modularization, memory usage and performance (circles)
in thread modularization, memory usage and performance

A good idea, tye. Here is the code that proves it. I separated the two parts (create and read file), to prove that the error is in the reading.

First, create the big datafile:
#!/usr/bin/perl use Tie::Persistent; my %a = (); tie %a , 'Tie::Persistent', "bigdatafile" , 'rw'; for my $i (1...5000) { $a{"ENTRY$i"}{"has"}{"a lot"}{"of data"}; } untie %a;

Now read the big datafile:
#!/usr/bin/perl use strict; use Tie::Persistent; # use this time to look up the process # and see how much memory it consumes print "My Process ID is $$\nIn 10 seconds I will tie a big data file:\ +n"; for my $i (1..10) { print "$i\n"; sleep 1; } &loadData("bigdatafile"); # now look at memory usage again sleep 100; exit 0; sub loadData { my $file = shift; my %localhash = (); tie %localhash , 'Tie::Persistent', $file , 'rw'; print "File tied\n"; untie %localhash; print "File untied\n"; undef %localhash; }
Perl help me.