leapmotion / autowiring

A C++ Inversion of Control Framework
http://autowiring.io/
Apache License 2.0
149 stars 17 forks source link

Fix leak in thread_specific_ptr #948

Closed codemercenary closed 8 years ago

codemercenary commented 8 years ago

This leak is a slow leak on Windows caused by the way that TlsSetValue works. If the current context is assigned for a thread and never unassigned, then the shared pointer allocated for that thread could potentially not be freed, resulting in the leak.

Fix this issue by using FlsSetValue instead, which allows a teardown routine to be specified. On platforms that do not support this function, fall back to the old behavior.