Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19064 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40490 invoked by uid 1010); 16 Sep 2005 22:06:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 40475 invoked from network); 16 Sep 2005 22:06:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Sep 2005 22:06:49 -0000 X-Host-Fingerprint: 66.108.229.165 cpe-66-108-229-165.nyc.res.rr.com Received: from ([66.108.229.165:17984] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 87/AB-43379-8F14B234 for ; Fri, 16 Sep 2005 18:06:49 -0400 Message-ID: <87.AB.43379.8F14B234@pb1.pair.com> To: internals@lists.php.net Reply-To: "RG" References: <29.87.41173.A9FD9234@pb1.pair.com> <00f301c5ba49$455192c0$5c8be5a9@ohr.berkeley.edu> <5A.79.43379.A1E1A234@pb1.pair.com> <001901c5ba69$b6573c70$6c051fac@lighthammer> Date: Fri, 16 Sep 2005 18:06:45 -0400 Lines: 44 Organization: blah X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Posted-By: 66.108.229.165 Subject: Re: Segfault From: ScriptBlue@nyc.rr.com ("RG") Well I did try to use it in RINIT, but PHP just wasn't RINIT.... so I figured why not put it in MINIT. And I solved the problem, I guess I should have been more careful when reading the PHP API tutorials, I used malloc instead of emalloc, so malloc was causing gcc to miscalculate its size or make it quit with an error. Thank you for your help. ""Sara Golemon"" wrote in message news:001901c5ba69$b6573c70$6c051fac@lighthammer... > > That's not where it segfaults. The function works perfectly once. If I > > attempt to exit / > > die or call that function again, it segfaults. > > However, I have noticed that if I do not use ZEND_REGISTER_RESOURCE the > > program no longer segfaults. > > > I didn't say that's where it segfaults, I said that's where your problem is. > Just because you can write to a particular memory location once doesn't > change the fact that the memory in question doesn't belong to your new_sock > struct. Your code is tacking a relevant piece of data and just throwing it > out into the middle of the memory pool hoping it doesn't hit some swimmer in > the head in the process. Figure out why you can't malloc the struct first. > That one is a very clear, unambiguous crash-causing bug. > > > And sorry for the comments, someone people don't write the final version > > of > > a program on their first try. > > > I'd doubt anyone does. Writing well-indented code helps debugging though > (both for you and for people you ask to take a second look). Right now it's > all just cluttered. As my momma always told me, "If you'd clean up your > room once in awhile, you might find what you're looking for." > > And if my reply sounded harsh, it might have to do with the fact that you > ignored my suggestions on how to implement zend_fetch_list_dtor_id(). > > -Sara