Temporarily overriding memory limit in extension

php.internals

Bruce Bailey

19 years ago
Hi Some of my PHP scripts use a large volume of memory. Is there a way I can: 1) Increase the script memory limit, and 2) Force a garbage collect at script end (and reset the limit). I am currently using PHP 5.1.4 Thanks, Bruce _________________________________________________________________ Share your latest news with your friends with the Windows Live Spaces friends module. http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mk

Stanislav Malyshev

19 years ago
> Hi > > Some of my PHP scripts use a large volume of memory. Is there a way I can: > > 1) Increase the script memory limit, and > 2) Force a garbage collect at script end (and reset the limit).
From PHP, I guess you could do ini_set("memory_limit"), unless you are running in safe mode.
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/

Bruce Bailey

19 years ago
Thanks, that might work to change the limit. When I reset it at the end of the script, wouldn't the next script to be run by the Apache child be aborted since the amount of memory in use is now over the limit? Bruce
>From: Stanislav Malyshev <stas@zend.com> >To: Bruce Bailey <bruce1828@hotmail.com> >CC: internals@lists.php.net >Subject: Re: [PHP-DEV] Temporarily overriding memory limit in extension >Date: Fri, 01 Dec 2006 10:11:48 -0800 > >>Hi >> >>Some of my PHP scripts use a large volume of memory. Is there a way I >>can: >> >>1) Increase the script memory limit, and >>2) Force a garbage collect at script end (and reset the limit). > >From PHP, I guess you could do ini_set("memory_limit"), unless you are >running in safe mode. > >-- >Stanislav Malyshev, Zend Products Engineer >stas@zend.com http://www.zend.com/ > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php >
_________________________________________________________________ All-in-one security and maintenance for your PC.  Get a free 90-day trial! http://clk.atdmt.com/MSN/go/msnnkwlo0050000002msn/direct/01/?href=http://clk.atdmt.com/MSN/go/msnnkwlo0050000001msn/direct/01/?href=http://www.windowsonecare.com/?sc_cid=msn_hotmail

Stanislav Malyshev

19 years ago
> Thanks, that might work to change the limit. When I reset it at the end > of the script, wouldn't the next script to be run by the Apache child be > aborted since the amount of memory in use is now over the limit?
You don't have to reset it, changes set by scripts are automatically reverted to php.ini/default value once the request ends.
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/

Stanislav Malyshev

19 years ago
> Thanks, that might work to change the limit. When I reset it at the end > of the script, wouldn't the next script to be run by the Apache child be > aborted since the amount of memory in use is now over the limit?
You don't have to reset it, changes set by scripts are automatically reverted to php.ini/default value once the request ends.
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/