GNOME Bugzilla – Bug 660745
GPrivate leaks on Windows
Last modified: 2011-10-04 20:11:02 UTC
The TLS API on Windows doesn't have an in-built concept of destroy notifies, so we fake it from our thread exit code. That means that people who use GLib functions (like the slice allocator) from threads that weren't created by GLib are leaking memory.
Created attachment 198245 [details] [review] Add GPrivate destroy notify testcase Ensure that GPrivate destroy notifies are properly called. This test currently fails on win32 (where we are leaking).
Created attachment 198246 [details] [review] win32: stop leaking GPrivate data Instead of running the GPrivate destructors from our thread proxy code, run it from the DllMain handler for the DLL_THREAD_DETACH case. This should ensure that thread-local data is free at the exit of all threads -- not just the ones we created for ourselves.
Attachment 198245 [details] pushed as dd09a95 - Add GPrivate destroy notify testcase Attachment 198246 [details] pushed as f151291 - win32: stop leaking GPrivate data