[libvirt] libvirt-php and xpath function from libxml2

Vasiliy Tolstov v.tolstov at selfip.ru
Wed Oct 14 09:29:43 UTC 2015

2015-10-14 11:39 GMT+03:00 Michal Privoznik <mprivozn at redhat.com>:
> are you trying the latest git HEAD? Because I resolved some mem leaks there.
> Maybe the problem is, the value passed to caller is not unset()
> (something like free() in php), or we are setting wrong reference
> counters somewhere.

I'm try master head, also i'm add in get_string_from_xpath string
xmlNodeListGetString(doc, nodeset->nodeTab[i]->xmlChildrenNode, 1)
allocates char * that needs to be freed, but it only checked with
NULL, and later value is duplicated (allocating another memory block
in add_assoc_string_ex ) . i'm rearrange some code paths, but leaks
not solved.
I have simple php script, that use functions that internally use
get_string_from_xpath and after 100-200 executions i have is about
1.5Gb memory wasted by script. May be this is internally php problem,
i'm try unset, run gc but this is not helps.
I'm remove all functions that use get_string_from_xpath and get xml
via libvirt and after that all leaks dissapeared.

So i voted to remove unneded functions and provide only libvirt
bindings. All other logic can be created with provided binding. Like
golang libvirt binding.

Vasiliy Tolstov,
e-mail: v.tolstov at selfip.ru

More information about the libvir-list mailing list