diff --git a/plugins/python/symimporter.c b/plugins/python/symimporter.c
index 2e1361c8..ba4e744a 100644
--- a/plugins/python/symimporter.c
+++ b/plugins/python/symimporter.c
@@ -363,7 +363,8 @@ static PyMethodDef symzipimporter_methods[] = {
};
static void uwsgi_symimporter_free(struct _symimporter *self) {
- PyObject_Del(self);
+ PyObject_GC_UnTrack(self);
+ Py_TYPE(self)->tp_free((PyObject *)self);
}
@@ -387,7 +388,7 @@ static PyTypeObject SymImporter_Type = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT,
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE |Py_TPFLAGS_HAVE_GC,
"uwsgi symbols importer", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -625,7 +626,7 @@ static PyTypeObject SymZipImporter_Type = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT,
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE |Py_TPFLAGS_HAVE_GC,
"uwsgi symbols zip importer", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -667,7 +668,7 @@ static PyTypeObject ZipImporter_Type = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT,
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE |Py_TPFLAGS_HAVE_GC,
"uwsgi zip importer", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
diff --git a/welcome.py b/welcome.py
index 78cfefe0..75a48004 100644
--- a/welcome.py
+++ b/welcome.py
@@ -1,8 +1,11 @@
import uwsgi
import os
import gc
+import sys
gc.set_debug(gc.DEBUG_SAVEALL)
+print sys.modules
+
def xsendfile(e, sr):
sr('200 OK', [('Content-Type', 'image/png'), ('X-Sendfile', os.path.abspath('logo_uWSGI.png'))])
return ''
@@ -40,6 +43,8 @@ def application(env, start_response):
print env['wsgi.input'].fileno()
gc.collect(2)
+ print len(gc.get_objects())
+
return """
version %s