in reply to mem usage
Perl data structures (see PerlGuts Illustrated) need more memory than the mere user data they hold.
A quick check shows that reading 1_000_000 empty lines into an array (the way you do it) leads to a process size of 192MB on my machine (with Perl 5.10.1). So if you have 11_000_000 non-empty ones...
Update: using ikegami's suggestion, the memory usage for the same 1_000_000 empty lines reduces to 78MB without pre-extending, and (interestingly) 86MB with pre-extending the array ($#lines = 1_000_000). Update2: and 93MB with just $#lines = 100_000 (??)
Update3: with @lines = (), pre-extending the array no longer increases the memory requirements. But it doesn't help to reduce it either (presumably, it just improves speed).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: mem usage
by ikegami (Patriarch) on May 26, 2010 at 18:12 UTC | |
Re^2: mem usage
by halfcountplus (Hermit) on May 26, 2010 at 18:05 UTC | |
by ikegami (Patriarch) on May 26, 2010 at 18:37 UTC |