Tcl Source Code

Check-in [28ba7d5089]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Full cleanup of env cache when in a PURIFY build.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | core-8-6-branch
Files: files | file ages | folders
SHA3-256: 28ba7d5089ce87349117a1c902a1d808e53fa7c29f3fcf0428e5aab4a0821d5c
User & Date: pooryorick 2018-06-18 07:06:04.359
Context
2018-06-18
08:09
Avoid valgrind "still reachable" reports stemming from early termination of threads. check-in: 2d150958f0 user: pooryorick tags: core-8-6-branch
07:06
Full cleanup of env cache when in a PURIFY build. check-in: 28ba7d5089 user: pooryorick tags: core-8-6-branch
05:59
Plug leak in TclSetEnv. check-in: fdb8a91f37 user: pooryorick tags: core-8-6-branch
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/tclEnv.c.
719
720
721
722
723
724
725
726

727
728


729





730
731
732
733
734
735
736
TclFinalizeEnvironment(void)
{
    /*
     * For now we just deallocate the cache array and none of the environment
     * 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.

     */



    if (env.cache) {





	ckfree(env.cache);
	env.cache = NULL;
	env.cacheSize = 0;
	if ((env.ourEnviron != NULL)) {
	    ckfree(env.ourEnviron);
	    env.ourEnviron = NULL;
	}







|
>


>
>

>
>
>
>
>







719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
TclFinalizeEnvironment(void)
{
    /*
     * For now we just deallocate the cache array and none of the environment
     * 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.  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;
	if ((env.ourEnviron != NULL)) {
	    ckfree(env.ourEnviron);
	    env.ourEnviron = NULL;
	}