perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raymond Wan <>
Subject Re: Memory usage
Date Thu, 13 Sep 2007 04:51:41 GMT
Michael Peters wrote:
>> 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.

I'm not sure if the numbers reported are accurate, but if Unix/Linux is 
used, then you can run the program under "valgrind" or the Unix "time" 
command (with appropriate flags).

I don't know the details of perl, but I have written various data 
structures such as hashes in Perl and then C and the C version takes a 
lot less memory.  I'm sure there is overhead because the perl script is 
interpreted, but there is probably a lot more going on.  If you want to 
see how much memory the data structure (alone) is using, perhaps you 
(Will) can write two versions of the with and one without 
the data structure...take the difference, as reported by valgrind, time, 
or top and you'll get the space used by the data structure.


View raw message