I am facing this issue in my application which is multi-threaded.
Main thread spawns another thread which is doing some memory allocation internally.
//Main thread
if(p) {
Thread th1(TestFunc, 0);
}
//TestFunc in thread.
unsigned long TestFunc (void * param)
{
//Do some memory allocation.
}
It looks like both the thread are waiting for each other.
Callstack for the main thread is:
_OSSpinLockLockSlow
GMFree
operator delete (void *)
Thread:: ~Thread ()
Thread:: ~Thread ()
For the spawned thread
_OSSpinLockLockSlow
GMmalloc_zone_malloc_internal
This is the sample code of the problem.
It looks like both main thread and spawned thread are waiting for each other.
What is the cause of this _OSSpinLockLockSlow?