#250 Deallocate env vars when finalizing

open
Jeffrey Hobbs
5
2002-12-13
2002-12-13
Mo DeJong
No

Here is a patch that calls ckfree() in
TclFinalizeEnvironment
for env vars that Tcl has allocated. I ran into this while
trying to plug memory leaks in the core so that I could
figure out if my extension was leaking memory. This patch
will also reset the original environ pointer in
TclFinalizeEnvironment. While this fixes the memory leak,
I wanted someone else to review it to so they could look at
the environ string issue with a fresh eye. My question is,
should Tcl reset the original state after it is unloaded or
should it leave the possibly modified env array the
way it was and leak this memory? If leaking memory is
the way to go, would it make sense to allocate them with
malloc so that they do not show up as leaked memory with
TCL_MEM_DEBUG?

Discussion

  • Jeffrey Hobbs
    Jeffrey Hobbs
    2003-02-18

    Logged In: YES
    user_id=72656

    no patch?

     
  • Mo DeJong
    Mo DeJong
    2003-02-18

    Logged In: YES
    user_id=90858

    How very strange. I could have sworn I added the patch before.

     
  • Mo DeJong
    Mo DeJong
    2003-02-18

    Patch to deallocate env vars

     
    Attachments