summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2000-05-16 00:03:56 +0000
committerwtc%netscape.com <devnull@localhost>2000-05-16 00:03:56 +0000
commit863008e7654c67155d1960235372c81a86916165 (patch)
tree566fb71f5ee501dd0ae839132ce86914bd3aedb8
parent40eeb1cef893c0995b036fc63b58e7b9c9dd3b7b (diff)
downloadnspr-hg-863008e7654c67155d1960235372c81a86916165.tar.gz
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.
-rw-r--r--pr/src/misc/prthinfo.c13
-rw-r--r--pr/src/threads/combined/pruthr.c8
2 files changed, 8 insertions, 13 deletions
diff --git a/pr/src/misc/prthinfo.c b/pr/src/misc/prthinfo.c
index 2cfac1b2..67415420 100644
--- a/pr/src/misc/prthinfo.c
+++ b/pr/src/misc/prthinfo.c
@@ -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;
}
diff --git a/pr/src/threads/combined/pruthr.c b/pr/src/threads/combined/pruthr.c
index 0025bcbb..0bada3d1 100644
--- a/pr/src/threads/combined/pruthr.c
+++ b/pr/src/threads/combined/pruthr.c
@@ -1248,6 +1248,14 @@ PR_IMPLEMENT(PRThread*) _PR_CreateThread(PRThreadType type,
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));
thread->threadAllocatedOnStack = 1;