Re: Re: Zend Engine.
| From: | herrwitten@php.net | Date: | Sat, 09 Jul 2005 03:30:49 +0000 |
| Subject: | Re: Re: Zend Engine. | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-2591@lists.php.net to get a copy of this message | ||
Thank you for the response again.
This covered material really should centrally located. It is slightly unforgivable that a company like Zend doesn't offer the needed documentation.
I have put in a lot of work, days and days. I have the beginnings of a decent extension at 1071 lines of code. Through trial and error and grepping, I have managed to squash the leaks and figure out which functions are necessary.
Perhaps I could have shown code examples, but my needs are general. I have wanted to understand the system. Next time, I will be sure to pinpoint exactly what I mean.
On Jul 8, 2005, at 10:26 PM, Wez Furlong wrote:
I've yet to see sample code and a succint question about it. The things you've asked so far are really general and have been covered elsewhere. I suggest that you look at the (limited) zend api docs and also search for conference slides from internals talks that have been given over the years. If you're feeling dedicated, I suggest that you purchase George Schlossnagle's book "Advanced PHP Programming". We're happy to help, but only if you do some legwork yourself first. --Wez. On 7/8/05, herrwitten@php.net <herrwitten@php.net> wrote:On Jul 8, 2005, at 1:50 PM, Michael Wallner wrote:herrwitten@php.net wrote:Hey Mike, Thanks for the response. For the record and my ego, I have been a C programmer for a long time, and I have done extensive work in C++. My email with the multiple frees was an illustration of my frustration with the inconsistencies I had experienced. I am sorry that everyone is so caught up on that one email, because I asked a lot of direct questions in other emails. The Zend engine is really powerful, but it is sloppy, and I am having trouble figuring out the logic of it.I have read through many modules and through Zend internals, but I can't figure out what I need to do.Did you read a book about C programming so far? You must not free anything more than once. It's not a good idea to start writing a PHP extension without learning some C basics (and probably more) -- I know that, because I made the same mistake like you and tried to cook up some C code with minimal knowledge. Most of the time you'll want to use zval_ptr_dtor(zval **) to "destroy" zvals, because it takes care about the refcount and only frees the "contents" of the zval if the refcount reaches 0. It's just (bad) luck when the memory at the address of a freed location still contains the data you expect. I know it's very hard to get answers about php/ext coding, so it is even more important to ask the questions in a meaningful way. You'll also find many unanswered questions of mine in the archive. The pecl/http repository contains thousands of "blood & sweat" lines of code, perhaps you can find some answers there. Regards, Mike