summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorpooryorick <com.digitalsmarties@pooryorick.com>2018-06-18 07:06:04 (GMT)
committerpooryorick <com.digitalsmarties@pooryorick.com>2018-06-18 07:06:04 (GMT)
commit625aca976acac85e85a36f68a3727d2eec785922 (patch)
tree17a5cd0f082a98507d9c8744272e5fa8d3dee881 /generic
parente9c0ec1219e3c42df67c414bfda0bb5aab9a5bbb (diff)
downloadtcl-625aca976acac85e85a36f68a3727d2eec785922.zip
tcl-625aca976acac85e85a36f68a3727d2eec785922.tar.gz
tcl-625aca976acac85e85a36f68a3727d2eec785922.tar.bz2
Full cleanup of env cache when in a PURIFY build.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclEnv.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index c559c69..4a48f65 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -723,10 +723,18 @@ TclFinalizeEnvironment(void)
* strings. This may leak more memory that strictly necessary, since some
* of the strings may no longer be in the environment. However,
* determining which ones are ok to delete is n-squared, and is pretty
- * unlikely, so we don't bother.
+ * unlikely, so we don't bother. However, in the case of DPURIFY, just
+ * free all strings in the cache.
*/
+ size_t i;
+
if (env.cache) {
+#ifdef PURIFY
+ for (i = 0; i < env.cacheSize; i++) {
+ ckfree(env.cache[i]);
+ }
+#endif
ckfree(env.cache);
env.cache = NULL;
env.cacheSize = 0;