Hi Stéphane,

While I was testing the lua binding I did (based largely on the Python
one :) I noticed a memory leak when container objects were garbage
collected, and I think the Python binding may have it as well. I think
Container_dealloc() should probably do lxc_container_put() as shown in
the patch, but I am not too familiar with the Python type system /
object lifetime and I don't have python3 in order to test it. What do
you think?

8<---

diff --git a/src/python-lxc/lxc.c b/src/python-lxc/lxc.c
index b489079..162821d 100644
--- a/src/python-lxc/lxc.c
+++ b/src/python-lxc/lxc.c
@@ -62,6 +62,8 @@ convert_tuple_to_char_pointer_array(PyObject *argv) {
 static void
 Container_dealloc(Container* self)
 {
+    /* XXX not much we can do if _put fails? */
+    lxc_container_put(self->container);
     Py_TYPE(self)->tp_free((PyObject*)self);
 }
 

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to