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
I suggest a different fix. The problem is that there is no concept for shutting down tasks. They just run in endless while loops. This is fine, there is no need to clean up every bit when the process is stopping anyway, right? But, there should not be a SIGSEV creating an annoying memory dump. So, I suggest to create all global variables that are meant to exist forever, not as for example:
std::unordered_map<void*, size_t>* pAllocatedMemory = new std::unordered_map<void*, size_t>();
// and for convenience
std::unordered_map<void*, size_t>& allocatedMemory = *pAllocatedMemory;
What is the difference here? In the second case the global variable is never destroyed. This is the better behavior when there is no concept how long they can be used in tasks that live actually until the process is killed without any cleanup...
For me, this avoids the annoying SIGSEV that happens on almost every window closing.
And, btw, this allocatedMemory is used from different threads without any mutex protection. This can be well-defined, for example if the few accesses from a different thread (I observed 2 different threads accessing this global variable) are all before creating the "main task" where almost all of the further accesses seem to happen, but does not have to.
Activity
NeroBurner commentedon Mar 18, 2026
I can reproduce. Sim was always a bit wonky, but not sooooo reproducibly segfaulting
sofar commentedon Apr 1, 2026
During shutdown, destructors are called on a map that is already freed, resulting in the crash.
You can do something like this:
or more complex:
fix-vPortFree-use-after-destruction.patch
preitinger commentedon Jun 28, 2026
I suggest a different fix. The problem is that there is no concept for shutting down tasks. They just run in endless while loops. This is fine, there is no need to clean up every bit when the process is stopping anyway, right? But, there should not be a SIGSEV creating an annoying memory dump. So, I suggest to create all global variables that are meant to exist forever, not as for example:
But as
What is the difference here? In the second case the global variable is never destroyed. This is the better behavior when there is no concept how long they can be used in tasks that live actually until the process is killed without any cleanup...
For me, this avoids the annoying SIGSEV that happens on almost every window closing.
preitinger commentedon Jun 28, 2026
And, btw, this
allocatedMemoryis used from different threads without any mutex protection. This can be well-defined, for example if the few accesses from a different thread (I observed 2 different threads accessing this global variable) are all before creating the "main task" where almost all of the further accesses seem to happen, but does not have to.NeroBurner commentedon Jul 5, 2026
Patch from @sofar applid in PR #197
would love some feedback if it works for you (it works for me, but feedback would still be nice 😁 )