Re: cvs: php4 /ext/xml xml.c
| From: | Sterling Hughes | Date: | Sun, 15 Jun 2003 16:55:06 +0000 |
| Subject: | Re: cvs: php4 /ext/xml xml.c | ||
| References: | 1 2 3 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-21745@lists.php.net to get a copy of this message | ||
I think all memory handling should be done with PHP, as you can see
there are many places in simplexml where I avoid a copy by relying on
the fact that the libxml2 memory will be allocated by php's mm.
-Sterling
On Sun, 2003-06-15 at 13:04, Rob Richards wrote:
> ----- Original Message -----
> From: Moriyoshi Koizumi
>
> > > Looks pretty much pretty much how it is done in libxml
> (xmlGetGlobalState).
> > > Will this cause any problems mandating the memory behavor in /etc/xml?
> >
> > As far as I looked over the libxml code, xmlMemSetup doesn't work
> > in sync with the other part of the library as it seems to take it for
> > granted that xmlMemSetup() is called prior to any libxml initialisation
> > routines. That's why I'm under the impression that it's our task to to do
> > it in the PHP side.
>
> If you want to override the memory handling, i.e. currently it uses
> free/malloc/realloc/strdup, then yes it will need to be setup. And it has to
> be setup prior to xmlInitParser as the globals will be allocated via that
> particular memory handler.
>
> Another thing, if the memory handler is changed, I am not sure what the
> affect on trying to debug the libxml memory will be. This is very important
> as, at least working in dom, there are so many scenarios that can happen and
> it would take forever trying to fix leaks coming from libxml.
>
> any reason you want to change the memory handling? I would just think that
> it would be one more thing that we would have to deal with.
>
> What I meant about the xmlGetGlobalState was how it handle the one time
> initialzation under threading.
>
> Rob
--
"C makes it easy to shoot yourself in the foot; C++ makes it harder,
but when you do, it blows away your whole leg."
- Bjarne Stroustrup