[lxc-devel] lxc python binding
Dwight Engen
dwight.engen at oracle.com
Mon Nov 26 17:55:52 UTC 2012
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);
}
More information about the lxc-devel
mailing list