Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-07-25
02:49 • Closed ticket [442646ffff]: Close Windows handle from _beginthreadex plus 7 ... artifact: 52c055094d user: mdejong
02:02 • Ticket [442646ffff]: 4 changes artifact: 4f193fd13a user: hobbs
2001-07-24
11:43 • Ticket [442646ffff]: 4 changes artifact: 1802f7d9da user: mdejong
2001-07-20
05:26 • Ticket [442646ffff]: 1 change artifact: 406c18c2bd user: hobbs
2001-07-19
09:14 • Add attachment patch to ticket [442646ffff] artifact: adf61c4e37 user: mdejong
09:14 • Ticket [442646ffff] Close Windows handle from _beginthreadex status still Op... artifact: fe5e9a86ef user: mdejong
02:14 • New ticket [442646ffff]. artifact: c04206b137 user: mdejong

Close Windows handle from _beginthreadex

Closed / Accepted442646ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-07-19 02:14:06
The documentation for the _beginthreadex method
indicates that the caller is responsible for
closing the returned HANDLE object. Tcl does
not close this handle which seems like a memory
leak to me. The following patch should fix the
problem, but if someone that knows a bit more
about Windows threads could take a peek I would
feel much better about it. The part I am unsure
of is if it is ok to call CloseHandle() on
a thread handle that is currently alive.


Here are some related URLs:

http://support.microsoft.com/support/kb/articles/q132/0/78.asp
http://technology.niagarac.on.ca/courses/comp831/win32/_beginthread.htm
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_crt__beginthread.2c_._beginthreadex.asp
http://www.microsoft.com/msj/0799/win32/win320799.htm


2001-07-18  Mo DeJong  <[email protected]>

* win/tclWinThrd.c (Tcl_CreateThread): Close Windows
HANDLE
returned by _beginthreadex since the MS documentation
states
that this handle is not closed by a later call to
_endthreadex.
mdejongplain2001-07-19 09:14:07
File Added - 8589: patch
hobbs Ticket [442646ffff]: 1 change [History diff]2001-07-20 05:26:26
mdejongplain2001-07-24 11:43:08
Logged In: YES 
user_id=90858

Any reaction to this patch? It is kind of holding up
another Cygwin patch so I if someone could take a
look at it that would be great. I ran the tcl tests
and the thread tests with this patch applied and
I did not notice any ill effects.
hobbsplain2001-07-25 02:02:17
Logged In: YES 
user_id=72656

Sorry, at the conference and right before makes things a 
little hectic for checking patches.  Anyway, this looks 
correct to me.  If it passes 'make test' on Windows with 
and without --enable-symbols, then I'd say put it in.
mdejongplain2001-07-25 02:49:59
Logged In: YES 
user_id=90858

Ok, I am adding this patch since it does not
change any of the test results and should plug
a memory leak.
Log in (anonymous is fine) to add a comment.

Attachments: