Re: Reducing memory footprint?

Alan Burlison (Alan.Burlison@uk.sun.com)
Sat, 13 Mar 1999 00:06:18 +0000


> I'm going to do some experiments when the benchmark proper is finished
> to try to figure out just how much heap page sharing there is.

Here are the stats from forking 5000 copies of the same process after
first loading all the shared modules in the parent process.  The modules
in question were the libwww ones.  The Perl was 5.005_02 compiled with
perl malloc and libperl.so, running on Solaris 2.6

HEAP STATISTICS
---------------
Total Gb  	Resident Gb	Shared Gb	Private Gb
14.48		13.82		2.39		11.44 

i.e. a 16.5% sharing - not brilliant, but 2.39Gb of memory is still a
significant saving!

 From watching the machine whilst the test was running the amount of page
sharing gradually declined as the scripts ran.  I suspect this was
caused by heap 'churn' due to the large number of malloc/frees being
performed. The miniumum unit of sharing is a page (8k), and if a page
holds both parse tree and data, any writes to the data in the page will
cause the whole page to be copied.  If it was possible to put the parse
tree into an area seperate from the data I think the degree of page
sharing would be significantly higher than 16%.

Alan Burlison