Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42700 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54738 invoked from network); 19 Jan 2009 09:33:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jan 2009 09:33:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=johncart@cisco.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=johncart@cisco.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain cisco.com designates 144.254.224.140 as permitted sender) X-PHP-List-Original-Sender: johncart@cisco.com X-Host-Fingerprint: 144.254.224.140 ams-iport-1.cisco.com Received: from [144.254.224.140] ([144.254.224.140:36611] helo=ams-iport-1.cisco.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 70/D0-50097-EC844794 for ; Mon, 19 Jan 2009 04:33:02 -0500 X-IronPort-AV: E=Sophos;i="4.37,288,1231113600"; d="scan'208";a="31233257" Received: from ams-dkim-2.cisco.com ([144.254.224.139]) by ams-iport-1.cisco.com with ESMTP; 19 Jan 2009 09:32:58 +0000 Received: from ams-core-1.cisco.com (ams-core-1.cisco.com [144.254.224.150]) by ams-dkim-2.cisco.com (8.12.11/8.12.11) with ESMTP id n0J9WwrO001495; Mon, 19 Jan 2009 10:32:58 +0100 Received: from xbh-ams-332.emea.cisco.com (xbh-ams-332.cisco.com [144.254.231.87]) by ams-core-1.cisco.com (8.13.8/8.13.8) with ESMTP id n0J9Wwhu000452; Mon, 19 Jan 2009 09:32:58 GMT Received: from xmb-ams-33e.emea.cisco.com ([144.254.231.75]) by xbh-ams-332.emea.cisco.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 19 Jan 2009 10:32:58 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Mon, 19 Jan 2009 10:32:57 +0100 Message-ID: In-Reply-To: <4973DB36.3010703@tekrat.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] PATCH: zend_mm_heap_overflow() Thread-Index: Acl518o7kZsjNxiCQMiVi/ivMpHgnwAQJN3g References: <4973DB36.3010703@tekrat.com> To: "shire" , "PHP Internals List" X-OriginalArrivalTime: 19 Jan 2009 09:32:58.0431 (UTC) FILETIME=[EA3B04F0:01C97A18] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; l=2580; t=1232357578; x=1233221578; c=relaxed/simple; s=amsdkim2001; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=johncart@cisco.com; z=From:=20=22John=20Carter=20-X=20(johncart=20-=20PolicyApp= 20Ltd=20at=20Cisco)=22=20 |Subject:=20RE=3A=20[PHP-DEV]=20PATCH=3A=20zend_mm_heap_ove rflow() |Sender:=20; bh=sNP5mIQ8zHdEIEQYLbVnJyfDFv+vRW+p87tm2hZNllM=; b=vzyr2NXLmBgrXdeKShKFD3xblmnoZutL4OVzSVnhLWHa4xKqt0mKIPX7jj 0FhHZ/Tcnu0WYVU+DMsg1tngc8c4pJ/dkxSOtNiRwJBx71Ex/vSQ7eXdPHPU 5A+zp+NLAi; Authentication-Results: ams-dkim-2; header.From=johncart@cisco.com; dkim=pass ( sig from cisco.com/amsdkim2001 verified; ); Subject: RE: [PHP-DEV] PATCH: zend_mm_heap_overflow() From: johncart@cisco.com ("John Carter -X (johncart - PolicyApp Ltd at Cisco)") Shire, Xlog looks really useful. Does it also help with "exception thrown without a stack trace"? Thanks, John.=20 -----Original Message----- From: shire [mailto:shire@tekrat.com]=20 Sent: 19 January 2009 01:45 To: PHP Internals List Subject: [PHP-DEV] PATCH: zend_mm_heap_overflow() I'm releasing an extended PHP logging extension that we currently use at facebook with much success. I currently use a small patch to determine if a memory overflow has occurred as there's currently no direct access into the allocator structures. You can get more information on the project at http://tekrat.com/php/xlog/. It would be useful if this patch (and perhaps more accessors into the memory allocator) where added. Although I understand there should be some careful choices and limitations here, and this case is a pretty specific use case, but I thought I'd share it in case there are others who happen to find this useful as well or perhaps someone can propose a more general alternative. Patches for different branches are here (I've pasted php53 below): http://tekrat.com/downloads/bits/zend_mm_heap_overflow.php6.patch http://tekrat.com/downloads/bits/zend_mm_heap_overflow.php53.patch http://tekrat.com/downloads/bits/zend_mm_heap_overflow.php52.patch diff --git a/ZendEngine2/zend_alloc.c b/ZendEngine2/zend_alloc.c index 8853d06..b8884a0 100644 --- a/ZendEngine2/zend_alloc.c +++ b/ZendEngine2/zend_alloc.c @@ -2537,6 +2537,13 @@ ZEND_API void start_memory_manager(TSRMLS_D) #endif } +/*** BEGIN Patch: zend_mm_heap_overflow ***/ ZEND_API int=20 +zend_mm_heap_overflow(TSRMLS_D) { + return AG(mm_heap)->overflow; +} +/*** END Patch: zend_mm_heap_overflow ***/ + ZEND_API zend_mm_heap *zend_mm_set_heap(zend_mm_heap *new_heap TSRMLS_DC) { zend_mm_heap *old_heap; diff --git a/ZendEngine2/zend_alloc.h b/ZendEngine2/zend_alloc.h index d92df4b..3610931 100644 --- a/ZendEngine2/zend_alloc.h +++ b/ZendEngine2/zend_alloc.h @@ -231,6 +231,7 @@ struct _zend_mm_storage { }; ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_mem_handlers *handlers, size_t block_size, size_t reserve_size, int internal, void *params); +ZEND_API int zend_mm_heap_overflow(TSRMLS_D); /* Patch:=20 +zend_mm_heap_overflow */ ZEND_API zend_mm_heap *zend_mm_set_heap(zend_mm_heap *new_heap TSRMLS_DC); ZEND_API zend_mm_storage *zend_mm_get_storage(zend_mm_heap *heap); -shire -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php