diff options
author | pooryorick <com.digitalsmarties@pooryorick.com> | 2018-06-18 07:06:04 (GMT) |
---|---|---|
committer | pooryorick <com.digitalsmarties@pooryorick.com> | 2018-06-18 07:06:04 (GMT) |
commit | 625aca976acac85e85a36f68a3727d2eec785922 (patch) | |
tree | 17a5cd0f082a98507d9c8744272e5fa8d3dee881 /generic | |
parent | e9c0ec1219e3c42df67c414bfda0bb5aab9a5bbb (diff) | |
download | tcl-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.c | 10 |
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; |