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.


git-svn-id: svn://10.0.0.236/trunk@69913 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
wtc%netscape.com 2000-05-16 00:10:04 +00:00
parent 1dda5c3dbf
commit d8f463065f
2 changed files with 8 additions and 13 deletions

View File

@ -140,19 +140,6 @@ PR_ThreadScanStackPointers(PRThread* t,
if (status != PR_SUCCESS)
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;
}

View File

@ -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));