Hi,

I've got my embedded Gecko up and running. But now I'm getting memory
leaks.
To isolate the problem I've removed all browser instances from my
program, so now I only have a NS_InitEmbedding and a NS_TermEmbedding.
When run with:

XPCOM_MEM_LEAK_LOG=c:\memleak.log

defined, I get this as a result (removed some columns to improve
readability):

                                                Per-Inst   Leaked
Total      Rem
   0 TOTAL                                          32      772
4617       13
   2 BackstagePass                             20       20        1
      1
  20 XPCNativeScriptableShared          108      216       74        2
  22 XPCWrappedNative                       56      336      104
6
  59 nsJSID                                         36       36
33        1
  87 nsSystemPrincipal                        36       36        1
  1
  88 nsThread                                       72       72
4        1
  97 nsXPCComponents                        56       56        9
1

This looks to me like there is a thread that is not destroyed. The
remaining refcount for that thread is 6 btw. When I turn on these
options to track it down:

XPCOM_MEM_ALLOC_LOG=c:\alloc.log
XPCOM_MEM_LOG_CLASSES=nsThread

I get to see the allocs and frees of all threads which tells me that
thread nr 1 is never removed:

<nsThread> 0x0157DAB0 1 Create
<nsThread> 0x015A7D28 2 Create
<nsThread> 0x0160E8A0 3 Create
<nsThread> 0x0162CF60 4 Create
<nsThread> 0x0162CF60 4 Destroy
<nsThread> 0x0160E8A0 3 Destroy
<nsThread> 0x015A7D28 2 Destroy

The alloc text for the creation of thread 1 reads:

<nsThread> 0x0157DAB0 1 Create
 !nsRefPtr<nsThread>::assign_with_AddRef+0x000000000000001B
 !nsRefPtr<nsThread>::operator=+0x0000000000000013
 !nsThreadManager::Init+0x000000000000009D
 !NS_InitXPCOM3_P+0x0000000000000035
 !NS_InitXPCOM3+0x000000000000001D
 !NS_InitEmbedding+0x000000000000004A

Is this really a leak, or is the leak mechanism just not able to detect
the removal of this thread because it happens after the destruction of
the log system? Apart from Init/Term embedding I do nothing with Gecko.

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to