зеркало из https://github.com/mozilla/pjs.git
Bugzilla bug #39350: checked in patch from beard@netscape.com. Just
malloc the thread object if GC_LEAK_DETECTOR is defined. These thread objects will be leaked.
This commit is contained in:
Родитель
d7fa46b93b
Коммит
7f666fa64c
|
@ -141,19 +141,6 @@ PR_ThreadScanStackPointers(PRThread* t,
|
|||
return status;
|
||||
}
|
||||
|
||||
#ifdef GC_LEAK_DETECTOR
|
||||
/*
|
||||
** if the thread was allocated on its own stack, conservatively
|
||||
** scan the thread object itself to keep all data structures
|
||||
** referenced by the thread visible to the garbage collector.
|
||||
*/
|
||||
if (t->threadAllocatedOnStack) {
|
||||
status = scanFun(t, (void**)t, (sizeof(PRThread) + 3) / sizeof(void*), scanClosure);
|
||||
if (status != PR_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -1247,6 +1247,14 @@ PR_IMPLEMENT(PRThread*) _PR_CreateThread(PRThreadType type,
|
|||
if ((PRUptrdiff)top & 0x3f) {
|
||||
top = (char*)((PRUptrdiff)top & ~0x3f);
|
||||
}
|
||||
#endif
|
||||
#if defined(GC_LEAK_DETECTOR)
|
||||
/*
|
||||
* sorry, it is not safe to allocate the thread on the stack,
|
||||
* because we assign to this object before the GC can learn
|
||||
* about this thread. we'll just leak thread objects instead.
|
||||
*/
|
||||
thread = PR_NEW(PRThread);
|
||||
#endif
|
||||
stack->thr = thread;
|
||||
memset(thread, 0, sizeof(PRThread));
|
||||
|
|
Загрузка…
Ссылка в новой задаче