mirror of
https://github.com/python/cpython.git
synced 2025-11-15 16:09:29 +00:00
_Py_ReleaseInternedStrings(): Private API function to decref and
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.
This commit is contained in:
parent
8d7f0869ee
commit
a903ad9855
2 changed files with 12 additions and 0 deletions
|
|
@ -65,9 +65,11 @@ extern DL_IMPORT(PyObject *) _PyString_FormatLong(PyObject*, int, int,
|
||||||
#ifdef INTERN_STRINGS
|
#ifdef INTERN_STRINGS
|
||||||
extern DL_IMPORT(void) PyString_InternInPlace(PyObject **);
|
extern DL_IMPORT(void) PyString_InternInPlace(PyObject **);
|
||||||
extern DL_IMPORT(PyObject *) PyString_InternFromString(const char *);
|
extern DL_IMPORT(PyObject *) PyString_InternFromString(const char *);
|
||||||
|
extern DL_IMPORT(void) _Py_ReleaseInternedStrings(void);
|
||||||
#else
|
#else
|
||||||
#define PyString_InternInPlace(p)
|
#define PyString_InternInPlace(p)
|
||||||
#define PyString_InternFromString(cp) PyString_FromString(cp)
|
#define PyString_InternFromString(cp) PyString_FromString(cp)
|
||||||
|
#define _Py_ReleaseInternedStrings()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Macro, trading safety for speed */
|
/* Macro, trading safety for speed */
|
||||||
|
|
|
||||||
|
|
@ -3217,3 +3217,13 @@ PyString_Fini(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef INTERN_STRINGS
|
||||||
|
void _Py_ReleaseInternedStrings(void)
|
||||||
|
{
|
||||||
|
if (interned) {
|
||||||
|
Py_DECREF(interned);
|
||||||
|
interned = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* INTERN_STRINGS */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue