OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Subject: Re: Interesting observations...
From: Russ Allbery (rrastanford.edu)
Date: Mon Aug 28 2000 - 17:17:16 CDT


Brad Knowles <blkskynet.be> writes:
> At 4:26 PM +0100 2000/8/28, Lars Hecking wrote:

>> From the limited benchmarking with amavis-perl, I reckon that for
>> large files, perl allocates roughly 4x file size in memory before
>> doing anything else. Try a simple minimal perl program like
>>
>> use strict;
>> my all = <STDIN>;
>> print all;
>>
>> on a huge file, and check with top or proctool.

It shouldn't be quite *that* bad.

> If that's really going to allocate 4x500MB, I better find a
> bigger machine to run that on!

Perl is optimized for speed, not for memory consumption, and therefore can
eat memory pretty fast under some circumstances. Hashes are the worst
offenders; arrays shouldn't be too bad. Perl's allocating a lot of little
objects behind the scenes to keep track of things like string length,
numeric conversions, and so forth.

-- 
Russ Allbery (rrastanford.edu)             <http://www.eyrie.org/~eagle/>