Overview
| Artifact ID: | 7222ef4dfc3ff6605cf60335f4501cdf7ea3eb4b |
|---|---|
| Ticket: | 218821ffffffffffffffffffffffffffffffffff
Memory leak on thread creation |
| User & Date: | nobody on 2000-10-26 01:05:59 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- 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 - foundin changed to: "obsolete: 8.1"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "49. Threading"
- title changed to: "Memory leak on thread creation"
- type changed to: "Bug"