Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:28868 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26588 invoked by uid 1010); 16 Apr 2007 20:23:27 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 26573 invoked from network); 16 Apr 2007 20:23:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Apr 2007 20:23:27 -0000 Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain l-i-e.com from 67.139.134.202 cause and error) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:1931] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FE/22-18278-23BD3264 for ; Mon, 16 Apr 2007 16:23:15 -0400 Received: (qmail 41883 invoked by uid 98); 16 Apr 2007 20:23:15 -0000 Received: from 127.0.0.1 by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.01 (clamdscan: 0.88.7/3099. Clear:RC:1(127.0.0.1):. Processed in 0.078817 secs); 16 Apr 2007 20:23:15 -0000 Received: from localhost (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 16 Apr 2007 20:23:15 -0000 Received: from 216.230.84.67 (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Mon, 16 Apr 2007 15:23:15 -0500 (CDT) Message-ID: <35259.216.230.84.67.1176754995.squirrel@www.l-i-e.com> In-Reply-To: <7cea347c0704160319x619b26d0s7716e35493e122c4@mail.gmail.com> References: <7cea347c0704160319x619b26d0s7716e35493e122c4@mail.gmail.com> Date: Mon, 16 Apr 2007 15:23:15 -0500 (CDT) To: "David Sklar" Cc: internals@lists.php.net Reply-To: ceo@l-i-e.com User-Agent: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] Trapping "memory exhausted" error From: ceo@l-i-e.com ("Richard Lynch") You might also come at it from the other direction and detect/notify at some number smaller than the current hard limit, configurable in php.ini... This might play better with anything relying on the current behaviour. On Mon, April 16, 2007 5:19 am, David Sklar wrote: > I am interested in being able to trap the (currently) fatal error that > results when memory usage exceeds the defined memory limit. > > I was thinking it could work as follows: > > - in addition to a memory_limit configuration directive, there could > be a "memory_limit_grace" configuration directive. This gets stored in > the struct _zend_mm_heap, along with the limit. > > - Also added to struct _zend_mm_heap is a "initial limit reached" flag > > - When zend_mm_safe_error() in Zend/zend_alloc.c is invoked under the > current conditions (memory_limit exceeded), it sets the "initial limit > reached" flag, adjusts the heap limit to the "memory_limit_grace" > value and throws some non-fatal error (or an exception if it is > feasible from here.) > > - When zend_mm_safe_error() is invoked and the "initial limit reached" > flag is already set, it throws the fatal error exactly as it does now. > > This "grace period" would provide a way to gracefully exit when a > memory limit is reached, but also has the hard limit still enforced so > that code which is supposed to be gracefully exiting doesn't chew up > too much additional memory. > > Is it feasible to adjust the heap limit and throw a non-fatal error > from within zend_mm_safe_error()? > > David > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?