Skip to content
Tcl Source Code History Of Ticket 597936ffffffffff
Login

History Of Ticket 597936ffffffffff

Artifacts Associated With Ticket 597936ffffffffff

  1. Ticket change [b07ac7d139] (rid 97987) by msofer on 2002-08-20 20:39:58:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      The following script runs forever. With the new Tcl_Obj
      allocator (USE_THREAD_ALLOC) its memory grows slowly
      but steadily; all seems fine with the standard allocator.
      
        lappend auto_path /CVS/thread/unix
        package require Thread
        proc spawn {} {
            global i
            after 10 spawn
            thread::create "puts [incr i]"
            flush stdout
        }
        
        set i 0
        spawn
        vwait forever
        
      
    4. foundin initialized to: "None"
    5. priority initialized to: "9 Immediate"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "msofer"
    9. subsystem initialized to: "41. Memory Allocation"
    10. title initialized to: "leak in new thread allocator"
    11. type initialized to: "Bug"
  2. Ticket change [bca1ad062c] (rid 101785) by msofer on 2002-08-22 21:10:18:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Note that this has nothing to do with [after], the following
      shows the same behaviour:
      
      lappend auto_path /CVS/thread/unix
      package require Thread
      set i 0
      while 1 {
          thread::create "puts [incr i]"
      }
      
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  3. Ticket change [6fd80f387c] (rid 100380) by andreas_kupries on 2002-08-22 21:47:56:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Hm. Could it be that the pool of objects associated with a 
      thread is not freed after a thread is done. Or maybe they are 
      just shuffled around into the global pool. In both situations we 
      would have an ever-growing list of free objects. Either as true 
      leak, or simply because we keep creating thread-object-pools 
      but never using the allocated objects.
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  4. Ticket change [36a4d24dfd] (rid 107144) by msofer on 2002-08-22 22:03:02:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Mmhh ... seems to be related to tclsh not cleaning up
      properly on exit - in particular, the encoding stuff. I
      could detect where the leak is with valgrind; the leaked mem
      was created from
      
      ==7357==    at 0x400467C4: malloc (vg_clientfuncs.c:100)
      ==7357==    by 0x805D430: TclThreadAllocObj (in
      /CVS/tcl_SF_clean/unix/tclsh)
      ==7357==    by 0x8055F87: Tcl_NewObj (in
      /CVS/tcl_SF_clean/unix/tclsh)
      ==7357==    by 0x80657C8: TclpInitLibraryPath (in
      /CVS/tcl_SF_clean/unix/tclsh)
      ==7357==    by 0x8089693: TclFindEncodings (in
      /CVS/tcl_SF_clean/unix/tclsh)
      ==7357==    by 0x8087C28: Tcl_FindExecutable (in
      /CVS/tcl_SF_clean/unix/tclsh)
      ==7357==    by 0x805508A: Tcl_Main (in
      /CVS/tcl_SF_clean/unix/tclsh)
      ==7357==    by 0x8054EE7: main (in /CVS/tcl_SF_clean/unix/tclsh)
      ==7357==    by 0x4029E627: __libc_start_main
      (../sysdeps/generic/libc-start.c:129)
      ==7357==    by 0x8054DE1: strcpy@@GLIBC_2.0 (in
      /CVS/tcl_SF_clean/unix/tclsh)
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  5. Ticket change [e350485c22] (rid 87775) by msofer on 2002-08-22 22:12:25:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Aarghh ... looking at the wrong place, disregard previous
      comment! Leak is from
      
      ==7385==    at 0x400467C4: malloc (vg_clientfuncs.c:100)
      ==7385==    by 0x805D430: TclThreadAllocObj (in
      /CVS/tcl_SF_clean/unix/tclsh)
      ==7385==    by 0x8055F87: Tcl_NewObj (in
      /CVS/tcl_SF_clean/unix/tclsh)
      ==7385==    by 0x8066EDB: Tcl_CreateInterp (in
      /CVS/tcl_SF_clean/unix/tclsh)
      ==7385==    by 0x4023F0D8: NewThread (in
      /CVS/thread/unix/libthread2.4.so)
      ==7385==    by 0x40250166: thread_wrapper (vg_libpthread.c:521)
      ==7385==    by 0x4004B7E0: do__apply_in_new_thread_bogusRA
      (vg_scheduler.c:2023)
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  6. Ticket change [0df9f67f28] (rid 94528) by andreas_kupries on 2002-08-22 22:16:55:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      This does seem to match my explanation. Objects allocated 
      during construction of the thread are not freed when tearing it 
      down. Possibly just moved over to the global pool.
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  7. Ticket change [cbf474e191] (rid 95607) by msofer on 2002-08-23 19:35:50:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      With an fprintf here and an fprintf there, eeah eeah oh...
      
      All objects should be moved to the global pool by the
      TclFreeAllocCache exit handler. However, some objects in
      each thread (in this example, 286 of them) are not being
      moved over at thread exit, and are leaked. 
      
      Apparently TclFreeAllocCache is being called before all
      objects have been decrRefCount'ed out of existence? From
      'man pthread_key_create':
      "The order in which destructor functions are called at
      thread termination  time is unspecified."
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  8. Ticket change [3393795718] (rid 106619) by vasiljevic on 2002-08-24 05:01:29:

    1. icomment:
      Logged In: YES 
      user_id=95086
      
      Simple. Here's the CVS diff: 
       
      Index: tclObj.c 
      =================================================================== 
      RCS file: /cvsroot/tcl/tcl/generic/tclObj.c,v 
      retrieving revision 1.39 
      diff -r1.39 tclObj.c 
      686c686,688 
      < 
      --- 
      > #ifdef USE_THREAD_ALLOC 
      >     TclThreadFreeObj(objPtr); 
      > #else 
      698a701 
      > #endif /* USE_THREAD_ALLOC */ 
       
      It was a simple matter of not calling the right release. 
      So the memory was allocated with the new and  
      released with the old allocator.  
      This is not a thread issue per-se.  
       
      Cheers 
      Zoran 
        
        
      
      
    2. login: "vasiljevic"
    3. mimetype: "text/plain"
    4. username: "vasiljevic"
  9. Ticket change [d3bd6280bc] (rid 123335) by vasiljevic on 2002-08-24 05:14:10:

    1. icomment:
      Logged In: YES 
      user_id=95086
      
      Unfortunately, this was not the only issue. Apparently,  
      there are some others, which I'm still looking at. 
      So, stay tuned. 
      
      
    2. login: "vasiljevic"
    3. mimetype: "text/plain"
    4. username: "vasiljevic"
  10. Ticket change [54e1d77862] (rid 94030) by msofer on 2002-08-24 07:29:52:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      I think it is the Tcl_DecrRefCount macro in tcl.h (line
      791). If we want to keep binary compatibility, we shouldn't
      modify that macro - rather redefine TclFreeObj() to do the
      right thing.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  11. Ticket change [dde546dafe] (rid 114759) by msofer on 2002-08-24 08:31:27:

    1. closedate changed to: "2002-08-24T01:31:27"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      OK, that was it. Zoran's patch was unlocking a mutex which
      hadn't been locked - fixed #ifdef's and committed to HEAD.
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "msofer"
  12. Ticket change [c22553dae2] (rid 111443) by msofer on 2002-08-24 21:16:50:

    1. assignee changed to: "vasiljevic"
    2. icomment:
      Logged In: YES 
      user_id=148712
      
      Oops ... I should get more sleep indeed! Zoran's patch did
      solve the issue, I had just applied it wrongly ...
      So: reopening, whatever else Zoran saw is not the error I
      was getting from his patch. Sorry Zoran :(
      
      
    3. login: "msofer"
    4. mimetype: "text/plain"
    5. resolution changed to: "Works For Me"
    6. status changed to: "Open"
    7. username: "msofer"
  13. Ticket change [17364aafbb] (rid 122451) by vasiljevic on 2002-08-29 16:38:05:

    1. closedate changed to: "2002-08-29T09:38:05"
    2. closer changed to: "vasiljevic"
    3. icomment:
      Logged In: YES 
      user_id=95086
      
      After careful (memdebug/purify) testing it seems that  
      this one can be closed safely. 
      
      
    4. login: "vasiljevic"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "vasiljevic"