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).
In reply to Re: mem usage
by almut
in thread mem usage
by halfcountplus
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |