malloc the thread object if GC_LEAK_DETECTOR is defined.  These thread
objects will be leaked.
This commit is contained in:
wtc%netscape.com 2000-05-16 00:10:04 +00:00
Родитель d7fa46b93b
Коммит 7f666fa64c
2 изменённых файлов: 8 добавлений и 13 удалений

Просмотреть файл

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