Bug 18488 - FastMalloc doesn't release thread-specific data on Windows
Summary: FastMalloc doesn't release thread-specific data on Windows
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Alexey Proskuryakov
Depends on:
Reported: 2008-04-14 06:09 PDT by Alexey Proskuryakov
Modified: 2008-04-14 09:34 PDT (History)
0 users

See Also:

proposed fix (3.98 KB, patch)
2008-04-14 06:17 PDT, Alexey Proskuryakov
aroben: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2008-04-14 06:09:51 PDT
FastMalloc uses pthreads support for thread-specific storage to make sure that destructors for data get called. However, pthreads-win32 only calls those from pthread_exit (or when the thread's main function returns, but only for threads created with pthread_create).

Since ThreadingWin.cpp uses native Win32 functions, I believe that this data just leaks when a thread finishes.

Patch forthcoming.
Comment 1 Alexey Proskuryakov 2008-04-14 06:17:16 PDT
Created attachment 20529 [details]
proposed fix
Comment 2 Adam Roben (:aroben) 2008-04-14 08:59:56 PDT
Comment on attachment 20529 [details]
proposed fix

+#include <process.h>
 #include "MainThread.h"
 #include <windows.h>
 #include <wtf/HashMap.h>
 #include <wtf/MathExtras.h>

I think process.h should be moved below MainThread.h

+unsigned __stdcall wtfThreadEntryPoint(void* param)

I think this should be declared static.

Comment 3 Alexey Proskuryakov 2008-04-14 09:34:04 PDT
Committed revision 31864 with suggested changes.