Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7222ef4dfc3ff6605cf60335f4501cdf7ea3eb4b
Ticket: 218821ffffffffffffffffffffffffffffffffff
Memory leak on thread creation
User & Date: nobody on 2000-10-26 01:05:59
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 2254 Bug
    Version: 8.1
    SubmitDate: '1999-06-21'
    LastModified: '1999-07-01'
    Severity: MED
    Status: Released
    Submitter: techsupp
    ChangedBy: foster
    OS: Other
    Machine: NA
    FixedDate: '1999-06-21'
    FixedInVersion: 8.2b1
    ClosedDate: '2000-10-25'
    
    
    Name:
    Andrej Vckovski
    
    CVS:
    tclUnixThrd.c 1.18 98/02/19 14:24:12
    
    ObservedBehavior:
    in TclpThreadCreate(), the pthread_attr_t attr structure is not
        destroyed.
        This causes a Memory Leak. However, I am not 100% sure if that's really
        ok, as I
        as a uninitalized memory read on thr_create() after fixing this. But
        according
        to POSIX threads definition an attr structure needs to be destroyed
        after usage.
    
    DesiredBehavior:
    no leak
    
    Patch:
    *** tclUnixThrd.c       Fri Jun 18 20:48:24 1999
    --- tclUnixThrd.c.fixed Fri Jun 18 19:53:42 1999
    ***************
    *** 71,85 ****
          Tcl_ThreadCreateProc proc;                /* Main() function of the thread */
          ClientData clientData;            /* The one argument to Main() */
      {
          pthread_attr_t attr;
    
          pthread_attr_init(&attr);
          pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
          if (pthread_create((pthread_t *)idPtr, &attr, (void * (*)())proc, (void *)clientData) < 0) {
    !       return TCL_ERROR;
          } else {
    !       return TCL_OK;
          }
      }
    
      /*
    --- 71,88 ----
          Tcl_ThreadCreateProc proc;                /* Main() function of the thread */
          ClientData clientData;            /* The one argument to Main() */
      {
    +     int res;
          pthread_attr_t attr;
    
          pthread_attr_init(&attr);
          pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
          if (pthread_create((pthread_t *)idPtr, &attr, (void * (*)())proc, (void *)clientData) < 0) {
    !       res = TCL_ERROR;
          } else {
    !       res = TCL_OK;
          }
    +     pthread_attr_destroy(&attr);
    +     return res;
      }
    
      /*
    
    PatchFiles:
    tclUnixThrd.c
    
    
    
    06/21/1999 11:53 - stanton - Applied patch
    
  4. foundin changed to: "obsolete: 8.1"
  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: "49. Threading"
  10. title changed to: "Memory leak on thread creation"
  11. type changed to: "Bug"