Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b3ff88c660e18ce1fa71103dd2926413e530a7aa
Ticket: 218027ffffffffffffffffffffffffffffffffff
Memory leak in core with Free object table
User & Date: nobody on 2000-10-26 00:52:20
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 1248 Bug
    Version: 8.0.3
    SubmitDate: '1999-02-22'
    LastModified: '1999-08-14'
    Severity: SER
    Status: Closed
    Submitter: welch
    ChangedBy: hobbs
    OS: IRIX
    Machine: Other
    FixedDate: '2000-10-25'
    ClosedDate: '1999-08-14'
    
    
    Name:
    
    Forest Rouse
    
    
    
    Extensions:
    
    blt2.4, expect 5.25, scotty 2.1.8, Tix 8.0.1, tkX 8.0.3
    
    
    
    CustomShell:
    
    Have not applied patches, no redefinitions, extended the core but the
    
    
    
    ReproducibleScript:
    
    None applicable -- Pretty much any tk script will see this problem
    
    
    
    
    
    
    
    ObservedBehavior:
    
    Didn't keep purify output
    
    
    
    
    
    
    
    Patch:
    
    *** tclObj.c~   Wed Apr  1 14:39:49 1998
    
    --- tclObj.c    Sun Feb  7 20:32:08 1999
    
    ***************
    
    *** 27,32 ****
    
    --- 27,38 ----
    
       */
    
      
    
      Tcl_Obj *tclFreeObjList = NULL;
    
    + typedef struct Tcl_ObjectChunks_ {
    
    +     char *chunk;
    
    +     struct Tcl_ObjectChunks_ *next;
    
    + } Tcl_ObjectChunks;
    
    + 
    
    + static Tcl_ObjectChunks *tclFreeObjAlloc = NULL;
    
      
    
      /*
    
       * Pointer to a heap-allocated string of length zero that the Tcl core uses
    
    ***************
    
    *** 189,195 ****
    
    --- 195,225 ----
    
      static void
    
      FinalizeFreeObjList()
    
      {
    
    +     /* First, run down all of the chunks.  It cannot be a
    
    +        Tcl_Obj (though I would have liked that) because
    
    +        we are getting rid of the data storage for all objects
    
    +        at this time.  They could be objects, but would
    
    +        have to be allocated in a mechanism seperate from
    
    +        Tcl_NewObj */
    
    +     
    
    +     Tcl_ObjectChunks *p = tclFreeObjAlloc;
    
    +     while (p) {
    
    +       char *chunk = p->chunk;
    
    +       Tcl_ObjectChunks *next = p->next;
    
    +       
    
    +       /* Free chunk, get rid of chunk descriptor and go to next
    
    +          descriptor. */
    
    +       
    
    +       ckfree(chunk);
    
    +       ckfree((char *) p);
    
    +       p = next;
    
    +     }
    
    +     
    
    +     /* Now note that both the free object list and the chunk
    
    +        allocation lists are empty */
    
    +     
    
          tclFreeObjList = NULL;
    
    +     tclFreeObjAlloc = NULL;
    
      }
    
      
    
    
    
      /*
    
    ***************
    
    *** 561,566 ****
    
    --- 591,597 ----
    
          size_t bytesToAlloc = (OBJS_TO_ALLOC_EACH_TIME * objSizePlusPadding);
    
          char *basePtr;
    
          register Tcl_Obj *prevPtr, *objPtr;
    
    +     register Tcl_ObjectChunks *chunkPtr;
    
          register int i;
    
      
    
          basePtr = (char *) ckalloc(bytesToAlloc);
    
    ***************
    
    *** 574,579 ****
    
    --- 605,617 ----
    
            objPtr = (Tcl_Obj *) (((char *)objPtr) + objSizePlusPadding);
    
          }
    
          tclFreeObjList = prevPtr;
    
    +     
    
    +     /* Now store the actual chunk that was allocated */
    
    +     
    
    +     chunkPtr = (Tcl_ObjectChunks *) ckalloc(sizeof(Tcl_ObjectChunks));
    
    +     chunkPtr->chunk = basePtr;
    
    +     chunkPtr->next = tclFreeObjAlloc;
    
    +     tclFreeObjAlloc = chunkPtr;
    
      }
    
      #undef OBJS_TO_ALLOC_EACH_TIME
    
      
    
    
    
    
    
    
    
    
    
    
    
    PatchFiles:
    
    tclObj.c
    
    
    
    
    
    
    
    This patch is no longer applicable to the code base (significant
    divergence).  The mem leak may have been fixed along the way. 
    -- 08/14/1999 hobbs
    
  4. foundin changed to: "obsolete: 8.0.3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: "Memory leak in core with Free object table"
  11. type changed to: "Bug"