Re: Segfault

From: Date: Fri, 16 Sep 2005 22:06:45 +0000
Subject: Re: Segfault
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-19064@lists.php.net to get a copy of this message
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"" <pollita@php.net> 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

« previous php.internals (#19064) next »