[Python-Dev] update on memory leaks in 2.2
Barry A. Warsaw
barry@zope.com
Fri, 7 Dec 2001 12:20:22 -0500
Note that there are tons of memory that is validly still alive when
Python exists. As we've seen, trying to clean all that up /can/ have
a big negative impact on shutdown. So I wouldn't worry about them.
Insure labels them as (paraphrasing) "memory still allocated at exit",
distinct from memory leaked. I think this is equivalent to Purify's
"potentially leaked" and "leaked" memory respectively.
Note that at least stringobject.c has a hook for clearing out all
those interned strings at program shutdown time, which I added to
clean up Insure's output. When INTERN_STRINGS is defined, the extra
function _Py_ReleaseInternedStrings() is defined. Then, in
Modules/main.c, in Py_Main(), if __INSURE__ is defined that function
is called, so this memory doesn't show up in the report.
It may be worthwhile generalizing this approach, and adding it to
other static long-lived data structures, simply as an aid to memory
debugging. As long as it isn't enabled by default, that should be
fine.
-Barry