You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug report was migrated from our old Bugzilla tracker.
Reported in version: 2.0.7 Reported for operating system, platform: Windows 10, x86_64
Comments on the original bug report:
On 2018-01-19 17:46:34 +0000, Jack Powell wrote:
SDL leaks memory on quit of the application. This can be found out by using Microsoft's built in CRT leak detection.
I fixed the leaks in my build of SDL by simply adding a call to SDL_TLSCleanup in SDL_Quit. The issue is thread-local storage is not cleaned up for the main thread. Because of my complex requirements I have made SDL_TLSCleanup a public function which would be something I think would be good for advanced users.
The leak you'll notice in SDL is the error string since it is TLS! The memory won't get freed until SDL_TLSCleanup is called so adding the call in SDL_Quit seems like a perfect solution for main thread quitting although maybe just incase the function should be exported and the winmain/main wrapper should call SDL_TLSCleanup (the one that calls SDL_SetMainReady)?
I've flagged this as major since the TLS not being cleaned up can cause issues where important cleanup is not done such as flushing settings or open data handles. This could cause loss or corruption of data in some applications.
Bug "3317 Memory Leak in SDL_SetError when using std::thread" may also relate to this. Adding SDL_TLSCleanup as an exported/public function would resolve third party threading such as std::thread as one could simply call SDL_TLSCleanup once the thread quits. Although applications using SDL should use SDL's create thread in my opinion.
Many Thanks
Jack Powell
On 2020-03-25 00:25:06 +0000, Ryan C. Gordon wrote:
Consolidating this with Bug # 5041.
*** This bug has been marked as a duplicate of bug 5041 ***
The text was updated successfully, but these errors were encountered:
This bug report was migrated from our old Bugzilla tracker.
Reported in version: 2.0.7
Reported for operating system, platform: Windows 10, x86_64
Comments on the original bug report:
On 2018-01-19 17:46:34 +0000, Jack Powell wrote:
On 2020-03-25 00:25:06 +0000, Ryan C. Gordon wrote:
The text was updated successfully, but these errors were encountered: