perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Peters <>
Subject Re: Memory usage
Date Tue, 11 Sep 2007 17:42:53 GMT
Will Fould wrote:
> Hi.  I'm trying to estimate (forecast) perl memory requirements for
> storing simple lists (hashes) in memory.
> If my lists use integers as keys and all values are either integers or
> simple scalar strings (of maximum size each), can the total memory size
> be estimated by simply factoring the total number of key=value pairs
> when considering the maximum byte size of each value? What other
> overhead is required for each list?

This will change depending on which version of Perl (the upcoming 5.10 is
supposed to be much nicer memory wise) and which OS you are using, so even if
you found some rule-of-thumb somewhere it wouldn't necessarily match what you'll

> Any links or discussion would be great.

You really need to benchmark it for yourself using the version you are
targetting and the OS. You can do it outside of apache and just have a simple
Perl script that does nothing but sleep after it's created the large data
structure you want. Then use something like top (or whatever the best tool on
your OS is) to see how much memory it takes us.

Michael Peters
Plus Three, LP

View raw message