From 213fbd7685984d837fa0c407272e84b869774c62 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 16 Nov 2009 12:55:39 -0600 Subject: [PATCH] bug 525573: in --enable-tracemalloc builds, initialize tracemalloc in XPCOM unit tests so as to support multi-threaded tests. r=jwalden --- xpcom/tests/TestHarness.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xpcom/tests/TestHarness.h b/xpcom/tests/TestHarness.h index 68226bffd03c..927d730aa86f 100644 --- a/xpcom/tests/TestHarness.h +++ b/xpcom/tests/TestHarness.h @@ -59,6 +59,10 @@ #include #include +#ifdef NS_TRACE_MALLOC +# include "nsTraceMalloc.h" +#endif + static PRUint32 gFailCount = 0; /** @@ -247,6 +251,11 @@ class ScopedXPCOM : public nsIDirectoryServiceProvider2 mTestName = testName; printf("Running %s tests...\n", mTestName); +#ifdef NS_TRACE_MALLOC + // nsAppRunner starts tracemalloc before init'ing XPCOM + NS_TraceMallocStartup(-1); // -1 == no logging +#endif + nsresult rv = NS_InitXPCOM2(&mServMgr, NULL, this); if (NS_FAILED(rv)) {