Memory usage
Con Tassios <[email protected]> Fri, 22 Feb 2008 15:36:52 +1100 (EST)
| Newsgroups | gmane.comp.apache.mod-layout |
|---|---|
| Message-ID | <[email protected]> |
Further to some emails to this list in Dec 2007 titled "mod_layout 5 memory
leak", the following PHP code demonstrates how memory usage of Apache processes
can increase enormously when mod_layout is used on PHP generated output.
Apache 2.2.8
PHP 5.2.5
mod_layout 5.1 and version from hg.tangent.org
Apache configuration:
AddOutputFilterByType LAYOUT text/html
LayoutFooter "<p> FOOTER<p>"
LayoutHeader "<p> HEADER<p>"
test1.php:
<html>
<head>
</head>
<body>
<? for ($i=0; $i<=20000; $i++) {
printf("[%d] abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%%^&*()<br>\n", $i);
}
?>
</body>
</html>
Output from the above scripts generated is about 1.6MB. On my system, Apache
process grows to about 1GB after a few accesses of the page. The same results
when PHP is run as an Apache module or run as a CGI.
A plain HTML file containing the same contents as the PHP generated output,
shows no increased memory usage in the Apache processes.