]> granicus.if.org Git - python/commitdiff
_Py_ReleaseInternedStrings(): Private API function to decref and
authorBarry Warsaw <barry@python.org>
Fri, 23 Feb 2001 16:40:48 +0000 (16:40 +0000)
committerBarry Warsaw <barry@python.org>
Fri, 23 Feb 2001 16:40:48 +0000 (16:40 +0000)
release the interned string dictionary.  This is useful for memory
use debugging because it eliminates a huge source of noise from the
reports.  Only defined when INTERN_STRINGS is defined.

Include/stringobject.h
Objects/stringobject.c

index 85ac0b6c02724ad281a4512fef259a88aeda4c2c..cadd78e47bdfd74c3aeefe9556c7e992dbab20e6 100644 (file)
@@ -65,9 +65,11 @@ extern DL_IMPORT(PyObject *) _PyString_FormatLong(PyObject*, int, int,
 #ifdef INTERN_STRINGS
 extern DL_IMPORT(void) PyString_InternInPlace(PyObject **);
 extern DL_IMPORT(PyObject *) PyString_InternFromString(const char *);
+extern DL_IMPORT(void) _Py_ReleaseInternedStrings(void);
 #else
 #define PyString_InternInPlace(p)
 #define PyString_InternFromString(cp) PyString_FromString(cp)
+#define _Py_ReleaseInternedStrings()
 #endif
 
 /* Macro, trading safety for speed */
index 9cf64bac581e034488fa08545eba26197ed05480..740cbe294e44ee6742092351d59c763fb303513b 100644 (file)
@@ -3217,3 +3217,13 @@ PyString_Fini(void)
        }
 #endif
 }
+
+#ifdef INTERN_STRINGS
+void _Py_ReleaseInternedStrings(void)
+{
+       if (interned) {
+               Py_DECREF(interned);
+               interned = NULL;
+       }
+}
+#endif /* INTERN_STRINGS */