summaryrefslogtreecommitdiffstats
path: root/Modules/main.c
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-02-23 16:46:39 (GMT)
committerBarry Warsaw <barry@python.org>2001-02-23 16:46:39 (GMT)
commit3e13b1e48bdd0550929f55bac11571116cd655ab (patch)
tree413f565047125fb73161b2a806a0a724d4f09dd8 /Modules/main.c
parenta903ad9855947ae885c4407be8d10ef8d5521010 (diff)
downloadcpython-3e13b1e48bdd0550929f55bac11571116cd655ab.zip
cpython-3e13b1e48bdd0550929f55bac11571116cd655ab.tar.gz
cpython-3e13b1e48bdd0550929f55bac11571116cd655ab.tar.bz2
Py_Main(): When compiled by Insure (i.e. __INSURE__ is defined), call
the internal API function to release the interned strings as the very last thing before returning status. This aids in memory use debugging because it eliminates a huge source of noise from the reports. This is never called during normal (non-debugging) use because releasing the interned strings slows Python's shutdown and isn't necessary anyway because the system will always reclaim the memory.
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 49dc4aa..bef2574 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -301,6 +301,20 @@ Py_Main(int argc, char **argv)
sts = PyRun_AnyFile(stdin, "<stdin>") != 0;
Py_Finalize();
+
+#ifdef __INSURE__
+ /* Insure++ is a memory analysis tool that aids in discovering
+ * memory leaks and other memory problems. On Python exit, the
+ * interned string dictionary is flagged as being in use at exit
+ * (which it is). Under normal circumstances, this is fine because
+ * the memory will be automatically reclaimed by the system. Under
+ * memory debugging, it's a huge source of useless noise, so we
+ * trade off slower shutdown for less distraction in the memory
+ * reports. -baw
+ */
+ _Py_ReleaseInternedStrings();
+#endif /* __INSURE__ */
+
return sts;
}