Debugging a memory leak
Dieter Maurer
dieter at handshake.de
Fri Oct 23 16:00:34 EDT 2020
Pasha Stetsenko wrote at 2020-10-23 11:32 -0700:
> ...
> static int my_init(PyObject*, PyObject*, PyObject*) { return 0; }
> static void my_dealloc(PyObject*) {}
I think, the `dealloc` function is responsible to actually
free the memory area.
I see for example:
static void
Spec_dealloc(Spec* self)
{
/* PyType_GenericAlloc that you get when you don't
specify a tp_alloc always tracks the object. */
PyObject_GC_UnTrack((PyObject *)self);
if (self->weakreflist != NULL) {
PyObject_ClearWeakRefs(OBJECT(self));
}
Spec_clear(self);
Py_TYPE(self)->tp_free(OBJECT(self));
}
More information about the Python-list
mailing list