Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63005 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96822 invoked from network); 14 Sep 2012 11:40:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Sep 2012 11:40:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=bapluda@yahoo.com.br; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=bapluda@yahoo.com.br; sender-id=unknown; domainkeys=good Received-SPF: error (pb1.pair.com: domain yahoo.com.br from 98.138.91.149 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: bapluda@yahoo.com.br X-Host-Fingerprint: 98.138.91.149 nm19-vm3.bullet.mail.ne1.yahoo.com Received: from [98.138.91.149] ([98.138.91.149:23993] helo=nm19-vm3.bullet.mail.ne1.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/DD-31416-0A713505 for ; Fri, 14 Sep 2012 07:40:16 -0400 Received: from [98.138.90.49] by nm19.bullet.mail.ne1.yahoo.com with NNFMP; 14 Sep 2012 11:40:13 -0000 Received: from [98.138.89.168] by tm2.bullet.mail.ne1.yahoo.com with NNFMP; 14 Sep 2012 11:40:13 -0000 Received: from [127.0.0.1] by omp1024.mail.ne1.yahoo.com with NNFMP; 14 Sep 2012 11:40:13 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 754985.72099.bm@omp1024.mail.ne1.yahoo.com Received: (qmail 39947 invoked by uid 60001); 14 Sep 2012 11:40:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.br; s=s1024; t=1347622813; bh=y+gnZpX2Lhvhc+X/N0Bj9suxFt3lo7eIlh9989t6tvI=; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=3i50+TUoUiQOWgebAfFPoqpnVF1XBLgwJM98zd5T6ntXoiA+88RCyO85dKyvjbEJaFF5h2c1mx2+3Afs6XFRhP7joEbNqof6Lnp/jUU61tp8ONt+ERqT3IZkBY26LrFsQsaIZhZqUsyMgWcLVk4UxGAs1M396rm/6C2lIpJ9StM= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=t4/V1tse9qLFwhFBuAhC9jOGu9wOn2hZ3G9NPDT/Iqq80MM9EIWkkk2cYACLo6eiLTJtQTNmntS8cKM2DORsz1uITSpDL6uN8s+uSxLVRNWlrYbdVwt3WqCiXBZ1JjjqHsdFrydw8D/QswmzaSWmGckN8nIA8Zb4XcNvNK6B8Wc=; X-YMail-OSG: O1nO2pEVM1mEEa4tcWH0IhGV7Z3WIM8P6bVwVZFsYBE_Yrw .bS_ZV_5txOPz23GmjRd4oEXAyS3Spmc.mkkoYyinTK.KZx6fnzS2ybrzZHR rqBiQqJRDBsoXhD4EuV43iJsSSbi0R0EcRq2Y6euCZNO1ISZp5QQAyRh_Xot wbfb6cXefsLk3y4V3y2CxgAaTjVqVLV1FNt1aGYGWTI6fqZeIB5G5vsQJU27 p7rZR9P2P6CVDgSvJ4Q.8Dz1UCfvOirNnIBtu_wiBAxhW5.9K0Ct.GTX6PzG j1WKUC54sFtBbrYlZRvyjPVHYiZksL95Cekeec90clIzsB0Nic73IsOtiO2y Co04545fiJz42ac9YWhTvkTvzljl6oHNVni1ZyBv.BB6pISlR0_ZmV3nc9YR C0pCh5oizIQ6gUrAJkxt2utQYblfeVxXQaCLpCV7YeOSA3fCzDDNd3JbFYBr W2jjnGiM6CBKytLR0omo2KrI- Received: from [83.240.187.65] by web120602.mail.ne1.yahoo.com via HTTP; Fri, 14 Sep 2012 04:40:13 PDT X-Mailer: YahooMailWebService/0.8.121.416 Message-ID: <1347622813.39145.YahooMailNeo@web120602.mail.ne1.yahoo.com> Date: Fri, 14 Sep 2012 04:40:13 -0700 (PDT) Reply-To: x x To: "internals@lists.php.net" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-1212189890-636992184-1347622813=:39145" Subject: Writing a PHP extension in C++, and memory leaks From: bapluda@yahoo.com.br (x x) ---1212189890-636992184-1347622813=:39145 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Is it safe to write PHP extensions in C++?=0AI read on Sara Golemon's book = that the zend engine can bailout on a request during a call to php_error_do= cref() or even an emaloc() that exceeds the allowed memory,=A0 doing an imm= ediate longjmp() to the shutdown part of the engine.=0Alongjmp() does not w= ork well with C++ destructors.=0AFor example:=0A[code]=0Avoid some_function= ( TSRMLS_D )=0A{=0A=A0Someclass obj( 3 );=0A=A0char *dst =3D emalloc(Moreth= anscriptlimit);=0A=A0...=0A=A0=0Avoid some_function( TSRMLS_D )=0A{=0A=A0So= meclass obj( 3 );=A0=0A=A0php_error_docref( NULL TSRMLS_CC, E_ERROR, "Some = error" );=0A=A0...=0A[/code]=0Ain these two cases ~Someclass() may never be= invoked on obj, if either php_error_docref() or emalloc calls longjmp().= =0A ---1212189890-636992184-1347622813=:39145--