When I add an object created locally to a mapping or sequence (that will be returned from a function into an running instance of the Python interpreter), I need to call Py_DECREF on the object, right? Unfortunately, I really feel like the following code leaks memory...
--- for example --- PyObject* list = Py_Buildvalue("[]"); while(go) { PyObject* num = Py_BuildValue("i", 10); PyList_Append(list, num); Py_DECREF(num); } return list; /* The responsibility of decrementing the list now lies within the scope of Python. */ --- end example --- Secondly, __and most importantly__, does anyone have any tools and/or recommendations for detecting memory leaks when writing extension modules in C? I've been using printf() and showing the OBJECT->ob_refcnt (which, is always 1 when I'm "done" with the pointer?) but this seems fairly newb. I'm mostly asking so I can cleanup any craziness in my code before I try and release pyiw (the Python bindings for Wireless Networking in Linux). I really want it to be as clean as possible before showing anyone else. :) -- http://mail.python.org/mailman/listinfo/python-list