Re: Trapping "memory exhausted" error

From: Date: Tue, 17 Apr 2007 17:29:44 +0000
Subject: Re: Trapping "memory exhausted" error
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-28891@lists.php.net to get a copy of this message
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. -- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/

« previous php.internals (#28891) next »