On Aug 28, 9:34 am, Jason Orendorff <[EMAIL PROTECTED]> wrote:
> More on this in a few hours.

I don't think there's such a thing as a contract that (a) is simple,
(b) is
efficient, (c) supports GC, (d) supports refcounting for objects that
want it,
and (e) really hides memory management implementation details.  So
there will
be design tradeoffs here.

For the sake of having a concrete proposal to chew on, I propose the
following:

  * Drop AddRef and Release from nsISupports.

  * Require all XPCOM objects to be MMgc GCObjects or
GCFinalizedObjects,
    allocated from the same GC allocator as all JavaScript objects.

    Read more about MMgc here:
      http://developer.mozilla.org/en/docs/MMgc

  * Change any code that depends on objects being destroyed in a
specific
    order, or at a specific time, to use some explicit means of
ensuring that
    it really happens that way, rather than depending on reference
counting.

  * Use static tools to replace our uses of nsCOMPtr and friends with
the MMgc
    equivalents, and replace nsISupportsWeakReference with MMgc
GCWeakRefs.

  * Add thread-safety to MMgc using the Spidermonkey request model.

  * Delete the cycle collector.

How did I do?  This proposal nails goal (c), does quite well on (a)
and OK on (b),
and ignores goals (d) and (e).  Maybe you can do better.

I'll be working on the following bug quite soon, so now is the time to
speak up.

  Bug 393034 - Allocate DOM objects using MMgc
  https://bugzilla.mozilla.org/show_bug.cgi?id=393034

-j

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

Reply via email to