Re: Memory leaks when embedding and using JavaXPCOM

Benjamin Smedberg <[email protected]> Wed, 01 Jul 2009 10:33:30 -0400
Newsgroups gmane.comp.mozilla.devel.java
Message-ID <[email protected]>
On 7/1/09 5:47 AM, David P=E9rez wrote:

> We=92ve made a simple XULRunner app, coded in Java.
> We=92ve observed that it has huge memory leaks.
> Rewriting the same app in Javascript, we observe no leaks.

That's certainly possible. JavaXPCOM doesn't have an owner and I may
consider removing it in the next release if we can't find an owner.

> So, we suspect there is some problem with JavaXPCOM.  Maybe the
> problem is related with the cycle collector.
> https://developer.mozilla.org/En/Interfacing_with_the_XPCOM_cycle_collect=
or

Is your code creating object cycles. In most cases if you are in control of
the code you can manually avoid object cycles by nulling references when
they are no longer needed. I suspect adding cycle-collection to the
JavaXPCOM interface would be very difficult, because it would require
knowing all the object edges through the Java GC heap.

--BDS