Re: [PHP-DEV] PHP extension - Saxon/C

2017-09-25 Thread O'Neil Delpratt
Problem resolved. It was actually the following line I had still there: Z_ADDREF_P(oth); > On 25 Sep 2017, at 11:36, O'Neil Delpratt wrote: > > Ok. Thanks for taking a look. > > Potenial problem could be the following line: > > const char * objName =ZSTR_VAL(Z_OBJCE_P(oth)->name); > > > I th

Re: [PHP-DEV] PHP extension - Saxon/C

2017-09-25 Thread O'Neil Delpratt
Ok. Thanks for taking a look. Potenial problem could be the following line: const char * objName =ZSTR_VAL(Z_OBJCE_P(oth)->name); I think I need to free the objName some how. > On 22 Sep 2017, at 18:42, Sara Golemon wrote: > >>> On Fri, Sep 22, 2017 at 12:21 PM, O'Neil Delpratt >>> wrote:

Re: [PHP-DEV] PHP extension - Saxon/C

2017-09-22 Thread Sara Golemon
>> On Fri, Sep 22, 2017 at 12:21 PM, O'Neil Delpratt wrote: >> I still have the memory leak without that line. I think I was thinking I >> need to add a refcount to the XdmNode object, but maybe I am wrong. >> > The Following gives leak: > > $proc = Saxon/SaxonProcessor > > $xquery = $proc->NewXQ

Re: [PHP-DEV] PHP extension - Saxon/C

2017-09-22 Thread O'Neil Delpratt
The Following gives leak: $proc = Saxon/SaxonProcessor $xquery = $proc->NewXQueryProcessor() $sourceNode = $proc->parseXmlFromString("”); $xquery->setContextItem($sourceNode); // with this line commented out there is no leak. > On 22 Sep 2017, at 17:32, Sara Golemon wrote: > > On Fri, Sep

Re: [PHP-DEV] PHP extension - Saxon/C

2017-09-22 Thread Sara Golemon
On Fri, Sep 22, 2017 at 12:21 PM, O'Neil Delpratt wrote: > I still have the memory leak without that line. I think I was thinking I need > to add a refcount to the XdmNode object, but maybe I am wrong. > What's the shortest possible script you can reproduce the leak with? Is (new XQueryProcessor

Re: [PHP-DEV] PHP extension - Saxon/C

2017-09-22 Thread O'Neil Delpratt
I still have the memory leak without that line. I think I was thinking I need to add a refcount to the XdmNode object, but maybe I am wrong. > On 22 Sep 2017, at 17:09, Sara Golemon wrote: > > On Fri, Sep 22, 2017 at 7:01 AM, O'Neil Delpratt wrote: >> Z_ADDREF_P(oth); >> > It's a little

Re: [PHP-DEV] PHP extension - Saxon/C

2017-09-22 Thread Sara Golemon
On Fri, Sep 22, 2017 at 7:01 AM, O'Neil Delpratt wrote: > Z_ADDREF_P(oth); > It's a little rough staring through all the commented out lines and inconsistent indenting, but this line stands out to me. Where is oth's refcount meant to be decremented? Why is it even being incremented in the

Re: [PHP-DEV] PHP extension - Saxon/C

2017-09-22 Thread O'Neil Delpratt
> On 22 Sep 2017, at 15:40, Johannes Schlüter wrote: > > On Fr, 2017-09-22 at 12:01 +0100, O'Neil Delpratt wrote: >> >> [Fri Sep 22 08:56:42 2017] Script: '/home/ond1/work/svn/latest9.8- >> saxonc/hec/samples/php/xqueryExamples.php' >> /home/ond1/work/svn/latest9.8- >> saxonc/hec/Saxon.C.API

Re: [PHP-DEV] PHP extension - Saxon/C

2017-09-22 Thread Johannes Schlüter
On Fr, 2017-09-22 at 12:01 +0100, O'Neil Delpratt wrote: >  > [Fri Sep 22 08:56:42 2017]  Script:  '/home/ond1/work/svn/latest9.8- > saxonc/hec/samples/php/xqueryExamples.php' > /home/ond1/work/svn/latest9.8- > saxonc/hec/Saxon.C.API/php7_saxon.cpp(3250) :  Freeing  [...] > See full code of PHP ext

[PHP-DEV] PHP extension - Saxon/C

2017-09-22 Thread O'Neil Delpratt
Hi, I am having a problem in my PHP extension and I am wondering if you can give me some advise or even a pointer. We have the following class object XQueryProcessor and XdmNode. The following method takes the XdmNode as parameter: XQueryProcessor.setContextItem(XdmNode) Any idea what is goi