Re: Trapping "memory exhausted" error
| From: | David Sklar | Date: | Wed, 18 Apr 2007 07:50:52 +0000 |
| Subject: | Re: Trapping "memory exhausted" error | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-28915@lists.php.net to get a copy of this message | ||
On 4/17/07, Stanislav Malyshev <stas@zend.com> wrote:
In my current situation, bail out, but gracefully -- perhaps just send a 302 to an error page and exit; maybe instead throw away the output buffer and then directly output some friendly error text. I think you can do it with shutdown handler, shouldn't it work? I.e. you can do it this way: 1. Install shutdown handler 2. Do something that takes a lot of memory 3. Memory is exhausted, script is terminated 4. The memory allocated by "something" is cleaned up, part by the engine, part manually 5. Shutdown handler does something like output "sorry, better luck next time" requiring minimal amount of memory.Ah, excellent, thanks. I'll take a look. This looks like what http://ez.no/doc/components/view/latest/(file)/Execution/ezcExecution.html does (Derick mentions this in the comments at http://php100.wordpress.com/2007/04/16/graceful-recovery/) David