Memory limit issue (malloc) for PHP script under Apache
Alex Zbyslaw
xfb52 at dial.pipex.com
Wed Dec 7 07:08:15 PST 2005
Olaf Greve wrote:
> Hi all,
>
> A colleague of mine has run into a weird issue, for which we hope
> someone knows a solution (or otherwise: if someone knows there's no
> (easy) solution, that's also good to know.
>
> The issue: when running a script that will consume a large amount of
> memory (under FreeBSD 5.2.1-release i386, with custom kernel, with
> Apache 1.3.34_2, PHP 4.4.1 as mod_php4); Apache seems to deschedule
> the script in question as soon as it starts to consume over more or
> less 512MB of memory; the machine has 1GB of memory, and at the moment
> of running the script the rest of the machine is pretty much idle.
It's probably a limit problem.
If you were running apache2 you'd have easy control over limits:
From /usr/local/etc/rc.d/apache.sh
# apache2limits_args (str): Default to "-e -C daemon"
# Arguments of pre-start limits run.
which, IIUC picks up limits from /etc/login.conf class daemon (which on
5.4 seems to default to everything unlimited).
You could just try hacking your apache1 startup script and putting:
ulimit -m unlimited
somewhere at the start.
Type ulimit -a to see all the possibles or man sh.
You can put the ulimit -a in your start up script too just so you can
see what the limits are when apache starts.
--Alex
More information about the freebsd-questions
mailing list