Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cycle collector coverage analysis

1 view
Skip to first unread message

bre...@mozilla.org

unread,
Mar 14, 2008, 12:38:58 AM3/14/08
to
I may have missed this, but do we have a dehydra script to look for
objects that are ref-counted, that contain what appear to be member
pointers to other ref-counted types, that are not users of the
NS_CYCLE_COLLECTION_*. We'd want this soon, in case something turns up
that's easy to fix for Gecko 1.9. Thanks,

/be

Benjamin Smedberg

unread,
Mar 14, 2008, 9:38:31 AM3/14/08
to

This analysis doesn't sound hard, but you're going to end up with lots of
false-positives: i.e. all the necko classes, which certainly have
member-comptrs but can't be cycle-collected because they are multi-threaded
objects.

I don't think we are or should be trying to cycle-collect every XPCOM object
that has strong refs (even just the single-thread ones)... doing so would
require lots and lots of additional classes be cycle-collected: you'd have
to add many services which already have application lifetime, so the cycle
collector would only be a benefit in cleaning up shutdown cycles, if at all.
Some examples that come immediately to mind:

* observer service
* prefservice
* appstartup

cc'ing dev.platform in

--BDS

bre...@mozilla.org

unread,
Mar 14, 2008, 6:30:28 PM3/14/08
to
On Mar 14, 6:38 am, Benjamin Smedberg <benja...@smedbergs.us> wrote:

> bren...@mozilla.org wrote:
> > I may have missed this, but do we have a dehydra script to look for
> > objects that are ref-counted, that contain what appear to be member
> > pointers to other ref-counted types, that are not users of the
> > NS_CYCLE_COLLECTION_*. We'd want this soon, in case something turns up
> > that's easy to fix for Gecko 1.9. Thanks,
>
> This analysis doesn't sound hard, but you're going to end up with lots of
> false-positives: i.e. all the necko classes, which certainly have
> member-comptrs but can't be cycle-collected because they are multi-threaded
> objects.

This is no objection, it's a trivial tweak to my (very non-
algorithmic) sketch! ;-)

Of course, we have some bogo-threadsafe XPCOM classes that are main-
thread only and should be considered in the scan. Never said it was
easy, but the decision tree to reduce false positives beckons already.

/be

bre...@mozilla.org

unread,
Mar 14, 2008, 6:31:58 PM3/14/08
to

Jonas Sicking

unread,
Mar 17, 2008, 6:55:26 PM3/17/08
to bre...@mozilla.org

To get fewer false positives we could only warn for members that hold
references to objects that participate in cycle collection.

/ Jonas

sayrer

unread,
Mar 17, 2008, 11:29:13 PM3/17/08
to
On Mar 17, 6:55 pm, Jonas Sicking <jo...@sicking.cc> wrote:
>
> To get fewer false positives we could only warn for members that hold
> references to objects that participate in cycle collection.

FWIW, I haven't found the false positives to be too troubling. Just
have to audit things.

- Rob

0 new messages