Skip to content
Tcl Source Code History Of Ticket 3383616fffffffffffffffffffffffffffffffff
Login

History Of Ticket 3383616fffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 3383616fffffffffffffffffffffffffffffffff

  1. Ticket change [c73511de15] (rid 121894) by gneumann on 2011-08-01 10:46:11:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Tcl 8.6b2 has a memory leak when re-bytecompiling procs. The cleanup-section in function TclProcCompileProc() (in file tclProc.c) iterates over "old" compiledLocals and frees it blindly (see below: ckfree(toFree)). However, the resolveInfo can contain data, and might point to to a deleteProc. i discovered the issue when using resolvers. The cleanup is handled correctly in TclProcCleanupProc() and in a similar way in InitResolvedLocals(). To ease maintenance one should factor out a common small c-function to handle the cleanup of compiled locals. The issue does not exist in Tcl 8.5.*. The following patch fixes the issue, and runs clean with valgrind.
      
      -gustaf neumann
      PS: i have submitted the bugreport already yesterday, but it did not show up so far. Maybe, there is something broken at sourceforge, so i try again. I hope, this will not generate a duplicate entry.
      
      --- generic/tclProc.c-orig2011-07-31 18:16:22.000000000 +0200
      +++ generic/tclProc.c2011-07-31 18:17:05.000000000 +0200
      @@ -2063,6 +2063,15 @@
       CompiledLocal *toFree = clPtr;
       
       clPtr = clPtr->nextPtr;
      +
      +if (toFree->resolveInfo) {
      +    if (toFree->resolveInfo->deleteProc) {
      +toFree->resolveInfo->deleteProc(toFree->resolveInfo);
      +    } else {
      +ckfree(toFree->resolveInfo);
      +    }
      +}
      +
       ckfree(toFree);
           }
           procPtr->numCompiledLocals = procPtr->numArgs;
      
      
    4. foundin initialized to: "obsolete: 8.6b2"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "gneumann"
    10. subsystem initialized to: "None"
    11. title initialized to:
      memory leak in Tcl 8.6 for compiled locals with resolveInfo
      
    12. type initialized to: "Bug"
  2. Ticket change [1744bec8cc] (rid 122458) by dgp on 2011-08-01 21:19:28:

    1. assignee changed to: "msofer"
    2. priority changed to: "9 Immediate"
    3. subsystem changed to: "22. [proc] and [uplevel]"
  3. Ticket change [d0b2847978] (rid 113225) by msofer on 2011-08-01 23:48:41:

    1. icomment:
      Thanks! Would it be possible for you to prepare a leak test for the testsuite?
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  4. Ticket change [f83b6b8c86] (rid 91503) by msofer on 2011-08-02 00:16:08:

    1. icomment:
      Committed to trunk; leaving open as reminder to add a test
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  5. Ticket change [4ba9d62ae5] (rid 126752) by msofer on 2011-08-02 00:16:09:

    1. closedate changed to: "2011-08-01T17:16:09"
    2. closer changed to: "msofer"
    3. priority changed to: "5 Medium"
    4. resolution changed to: "Fixed"
    5. status changed to: "Pending"
  6. Ticket change [81cf71e480] (rid 117112) by gneumann on 2011-08-02 18:34:06:

    1. icomment:
      Not sure, that i can. To reach this point, one needs C code. As far i can see there are currently no tests for Tcl_AddInterpResolvers() in the test suite at all. Furthermore, i am as well not sure, what's the recommend way to  write tests in C and integrate this with the tcl test suite.
      
      
    2. login: "gneumann"
    3. mimetype: "text/plain"
    4. username: "gneumann"
  7. Ticket change [9d4174919f] (rid 96269) by ferrieux on 2011-08-02 20:42:23:

    1. icomment:
      That sort of thing is done by extending tclTest.c and one of its ancillary files like tclTestObj.c.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  8. Ticket change [2b54070dbe] (rid 134172) by dkf on 2013-09-24 12:03:41:

    1. assignee changed to: "aku"
    2. closedate changed to: "2456560.00256878"
    3. closer changed to: "dkf"
    4. comment changed to:
      Tcl 8.6b2 has a memory leak when re-bytecompiling procs. The cleanup-section in function TclProcCompileProc() (in file tclProc.c) iterates over "old" compiledLocals and frees it blindly (see below: ckfree(toFree)). However, the resolveInfo can contain data, and might point to to a deleteProc. i discovered the issue when using resolvers. The cleanup is handled correctly in TclProcCleanupProc() and in a similar way in InitResolvedLocals(). To ease maintenance one should factor out a common small c-function to handle the cleanup of compiled locals. The issue does not exist in Tcl 8.5.*. The following patch fixes the issue, and runs clean with valgrind.
      
      -gustaf neumann
      PS: i have submitted the bugreport already yesterday, but it did not show up so far. Maybe, there is something broken at sourceforge, so i try again. I hope, this will not generate a duplicate entry.
      
      --- generic/tclProc.c-orig2011-07-31 18:16:22.000000000 +0200
      +++ generic/tclProc.c2011-07-31 18:17:05.000000000 +0200
      @@ -2063,6 +2063,15 @@
       CompiledLocal *toFree = clPtr;
       
       clPtr = clPtr->nextPtr;
      +
      +if (toFree->resolveInfo) {
      +    if (toFree->resolveInfo->deleteProc) {
      +toFree->resolveInfo->deleteProc(toFree->resolveInfo);
      +    } else {
      +ckfree(toFree->resolveInfo);
      +    }
      +}
      +
       ckfree(toFree);
           }
           procPtr->numCompiledLocals = procPtr->numArgs;
      
    5. login: "dkf"
    6. mimetype: "text/plain"
    7. severity changed to: "Minor"
    8. status changed to: "Closed"