Permalink
Browse files

Bug 503638 OOM crash [@ PL_DHashTableOperate | _MD_CURRENT_THREAD] in…

… nsCycleCollector

r=dbaron
  • Loading branch information...
timeless@mozdev.org
timeless@mozdev.org committed Feb 28, 2010
1 parent 9c6d706 commit 0c5fea1c7739521761f887b38d4d4c024c3f5f2e
Showing with 9 additions and 0 deletions.
  1. +9 −0 xpcom/base/nsCycleCollector.cpp
@@ -1377,6 +1377,7 @@ class GCGraphBuilder : public nsCycleCollectionTraversalCallback
GCGraphBuilder(GCGraph &aGraph,
nsCycleCollectionLanguageRuntime **aRuntimes);
~GCGraphBuilder();
+ bool Initialized();
PRUint32 Count() const { return mPtrToNodeMap.entryCount; }
@@ -1430,6 +1431,12 @@ GCGraphBuilder::~GCGraphBuilder()
PL_DHashTableFinish(&mPtrToNodeMap);
}
+bool
+GCGraphBuilder::Initialized()
+{
+ return !!mPtrToNodeMap.ops;
+}
+
PtrInfo*
GCGraphBuilder::AddNode(void *s, nsCycleCollectionParticipant *aParticipant
IF_DEBUG_CC_PARAM(PRUint32 aLangID)
@@ -2581,6 +2588,8 @@ nsCycleCollector::BeginCollection()
return PR_FALSE;
GCGraphBuilder builder(mGraph, mRuntimes);
+ if (!builder.Initialized())
+ return PR_FALSE;
#ifdef COLLECT_TIME_DEBUG
PRTime now = PR_Now();

0 comments on commit 0c5fea1

Please sign in to comment.