Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:28891 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74998 invoked by uid 1010); 17 Apr 2007 17:30:01 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 74983 invoked from network); 17 Apr 2007 17:30:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2007 17:30:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.114 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.114 unknown Windows 2000 SP4, XP SP1 Received: from [63.205.162.114] ([63.205.162.114:31479] helo=us-ex1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/F1-14509-71405264 for ; Tue, 17 Apr 2007 13:30:01 -0400 Received: from [127.0.0.1] ([192.168.16.109]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 17 Apr 2007 10:30:04 -0700 Message-ID: <46250408.6070608@zend.com> Date: Tue, 17 Apr 2007 10:29:44 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: David Sklar CC: internals@lists.php.net References: <7cea347c0704160319x619b26d0s7716e35493e122c4@mail.gmail.com> <4623BDF4.8010005@zend.com> <7cea347c0704170116j3ba50dbbrd7cc36780ead7164@mail.gmail.com> In-Reply-To: <7cea347c0704170116j3ba50dbbrd7cc36780ead7164@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 17 Apr 2007 17:30:04.0207 (UTC) FILETIME=[08E88BF0:01C78116] Subject: Re: [PHP-DEV] Trapping "memory exhausted" error From: stas@zend.com (Stanislav Malyshev) > 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/