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
Reported in version: HG 2.1 Reported for operating system, platform: Mac OS X (All), x86_64
Comments on the original bug report:
On 2016-05-03 20:46:25 +0000, Diego wrote:
Created attachment 2438
Leak producing code
When SDL_SetError is called from a thread created using std::thread there are two memory leaks. One is caused by a malloc in SDL_GetErrBuf and the other is caused by a realloc in SDL_TLSSet.
There are no leaks when using SDL_Thread, only when using std::thread.
This is reported by using Instruments on my mac. I believe this is the compiler and related information:
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
On 2017-08-12 03:44:10 +0000, Sam Lantinga wrote:
This is because SDL_TLSCleanup() doesn't get called and SDL doesn't link the C++ runtime and has no way to automatically call it at thread termination.
In a future release we could export a thread cleanup function that could be called to take care of this.
On 2020-03-05 08:19:59 +0000, wrote:
SDL_Quit() doesn't call it either.
On 2020-03-05 09:38:53 +0000, wrote:
// (Sketch code of another repro case)
int main()
{
SDL_SetMainReady(); // Can do normal startup, but this is simplest case
SDL_Init(0);
SDL_Quit();
return 0;
} // Will leak memory allocated in SDL_ClearError()
On 2020-03-05 09:46:53 +0000, wrote:
exposing SDL_TLSCleanup() via an extern, instead of it being static, then calling it in SDL_Quit() clears up my variant of the problem.
This bug report was migrated from our old Bugzilla tracker.
These attachments are available in the static archive:
Reported in version: HG 2.1
Reported for operating system, platform: Mac OS X (All), x86_64
Comments on the original bug report:
On 2016-05-03 20:46:25 +0000, Diego wrote:
On 2017-08-12 03:44:10 +0000, Sam Lantinga wrote:
On 2020-03-05 08:19:59 +0000, wrote:
On 2020-03-05 09:38:53 +0000, wrote:
On 2020-03-05 09:46:53 +0000, wrote:
On 2020-03-17 08:58:32 +0000, wrote:
On 2020-03-25 00:24:40 +0000, Ryan C. Gordon wrote:
The text was updated successfully, but these errors were encountered: