[Webkit-unassigned] [Bug 40302] [GTK] Memory managament for DOM GObject wrappers

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Nov 20 14:37:04 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=40302





--- Comment #12 from Xan Lopez <xan.lopez at gmail.com>  2010-11-20 14:37:04 PST ---
(In reply to comment #11)
> Kind of a nit, but I think I'd prefer this to be named something like timesReturned, since it isn't technically the reference count of the GObject. Also, this could be size_t.

Why size_t?

> 
> > WebCore/bindings/gobject/DOMObjectCache.cpp:82
> > +    Vector<DOMObjectCacheData*>::iterator last = toUnref.end();
> > +    for (Vector<DOMObjectCacheData*>::iterator it = toUnref.begin(); it != last; ++it) {
> > +        DOMObjectCacheData* data = *it;
> > +        while (data->refCount-- > 0)
> > +            g_object_unref(data->object);
> > +    }
> 
> There's some chance here that the object might die before you finish unreffing it, right? Say the user has unreffed only some of the return values. :/ Since there doesn't appear to be a way to peak at the reference count, maybe you should install a weak reference here and stop unreffing when you detect death. Another approach would be to keep information about dead objects in the cache and clear them at some later point. Wow, this is hairy.

I think adding a weak ref at the beginning of the process and stopping if it's triggered makes sense.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list