After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 678504 - Trace signal closures from the object instead of the context keep-alive
Trace signal closures from the object instead of the context keep-alive
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks: 679688
 
 
Reported: 2012-06-20 21:01 UTC by Giovanni Campagna
Modified: 2012-07-13 03:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Trace signal closures from the object instead of the context keep-alive (12.61 KB, patch)
2012-06-20 21:01 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2012-06-20 21:01:55 UTC
This is something I decided to try after seeing reports of massive
memory consumption in gnome-shell, which cannot be explained with normal
operation.
Basically, it associated signal closures strongly with the object they're
connected too, and clears them when the object becomes unreachable from
outside. To me, this is a behavior that makes sense, although it could
cause subtle bugs.
Comment 1 Giovanni Campagna 2012-06-20 21:01:57 UTC
Created attachment 216875 [details] [review]
Trace signal closures from the object instead of the context keep-alive

Implement tracing for GObjects and use it so that signal handlers
are rooted to the objects they're connected, and not the global
object. This means that if the object goes away and the only thing
referring to it is the handler function, it is recognized as a
cycle by the GC and collected, reducing memory leaks.
Other closures, as well as callback trampolines and vfuncs, are still
rooted in the usual way.
Comment 2 Jasper St. Pierre (not reading bugmail) 2012-06-25 08:19:44 UTC
Review of attachment 216875 [details] [review]:

I wonder if we should also do the same for trampolines. Looks fine.
Comment 3 Giovanni Campagna 2012-06-25 08:27:17 UTC
Attachment 216875 [details] pushed as 06aa616 - Trace signal closures from the object instead of the context keep-alive

As for trampolines, I thought of it, but where would you root them
to? The object on which the method was invoked?
Comment 4 Jasper St. Pierre (not reading bugmail) 2012-06-25 08:36:38 UTC
For a vfunc trampoline, it's quite obvious. I guess the object makes some sense, but I don't know if that could cause some issues.
Comment 5 Colin Walters 2012-07-13 02:50:06 UTC
So I think we should back this out until we've landed the fixes for calling JS_BeginRequest inside trace vfuncs.  See bug 679832.
Comment 6 Colin Walters 2012-07-13 02:52:44 UTC
Er, nevermind this was fixed by 54d60c278a39ce681b35d172b675a4b2d4449b65.  Sorry for the noise.