Any way to stop PHP taking >30 mb of RAM?
| From: | Matthew Brealey | Date: | Mon, 13 Nov 2000 11:17:07 +0000 |
| Subject: | Any way to stop PHP taking >30 mb of RAM? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24945@lists.php.net to get a copy of this message | ||
I have a script that generates several hundred HTML pages. Each page
has a navigation table (which requires recursive calls to read database
files), which initially I built for each page. This caused PHP to take
over the machine - I couldn't stop it, couldn't move the mouse, etc.
Eventually after leaving it thrashing the disk overnight I turned it
off. Fortunately although e2fsck failed the first time, I was able to
get my machine back.
I optimized my script by building the navigation tables only 25 instead
of 400 times, and then using regexps with back references on these
tables. It now completes. However, it takes so much memory (between 29
and 35mb (this is the total (my Apache uses mm under Linux with PHP 4
as a DSO)- not the sum of threads which some people get misled by) I
have to kill and restart httpd every time I run it - otherwise my
(64mb) machine becomes unusable.
Is there anything I can do to avoid this (particularly in view of the
fact that I will be offering PHP hosting to others, and don't want them
to do anything like this) - I would ideally like to run this script
online, but don't want to screw my host's machine.
-- Random fortune
I think I am an overnight sensation right now!!