Hi Jun'ichi,
Which are libvirt version and OS you're using? I also found a leak of XMLDesc() via
valgrind,
I think the generator should fix this, but you may wait for developers reply, thanks for
reporting this.
<valgrind>
==14265== 2,407 bytes in 1 blocks are definitely lost in loss record 1,457 of 1,550
==14265== at 0x4C2845D: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==14265== by 0x5C46624: xdr_string (in /usr/lib64/libc-2.17.so)
==14265== by 0xCFD9FCD: xdr_remote_nonnull_string (remote_protocol.c:31)
==14265== by 0xCFDC2C8: xdr_remote_domain_get_xml_desc_ret (remote_protocol.c:1617)
==14265== by 0xCFF0811: virNetMessageDecodePayload (virnetmessage.c:407)
==14265== by 0xCFE68FB: virNetClientProgramCall (virnetclientprogram.c:379)
==14265== by 0xCFBE8B1: callFull.isra.2 (remote_driver.c:6578)
==14265== by 0xCFC7F04: remoteDomainGetXMLDesc (remote_driver.c:6600)
==14265== by 0xCF8167C: virDomainGetXMLDesc (libvirt.c:4380)
==14265== by 0xCC2C4DF: libvirt_virDomainGetXMLDesc (libvirt.c:1141)
==14265== by 0x4F12B93: PyEval_EvalFrameEx (in /usr/lib64/libpython2.7.so.1.0)
==14265== by 0x4F141AC: PyEval_EvalCodeEx (in /usr/lib64/libpython2.7.so.1.0)
</valgrind>
--
Regards,
Alex
----- Original Message -----
From: "Junichi Nomura" <j-nomura(a)ce.jp.nec.com>
To: libvir-list(a)redhat.com
Sent: Friday, September 12, 2014 2:56:10 PM
Subject: [libvirt] libvirt-python: memory leak after GetXMLDesc?
Hello,
I've observed memory leak in long-running python program and
suspects a bug in libvirt-python.
libvirt-python contains auto-generated code like this:
libvirt_virDomainGetXMLDesc(...) {
...
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainGetXMLDesc(domain, flags);
LIBVIRT_END_ALLOW_THREADS;
py_retval = libvirt_charPtrWrap((char *) c_retval);
return py_retval;
}
virDomainGetXMLDesc() expects the caller to free c_retval.
Though it used to be freed in libvirt_charPtrWrap(), commit bb3301ba
("Don't free passed in args in libvirt_charPtrWrap /
libvirt_charPtrSizeWrap") has moved the responsibility to the outside.
So, it seems either GetXMLDesc should not depend on auto-generation or
the generator should be fixed.
Any comments?
--
Jun'ichi Nomura, NEC Corporation
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list