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 659253 - memory patches
memory patches
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks: 659254
 
 
Reported: 2011-09-16 14:43 UTC by Colin Walters
Modified: 2011-09-27 17:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
context: Add optional signal emitted after a GC finishes (4.26 KB, patch)
2011-09-16 14:43 UTC, Colin Walters
committed Details | Review
object: Run JS_updateMallocCounter() when creating GObjects (1.61 KB, patch)
2011-09-16 14:43 UTC, Colin Walters
committed Details | Review
context: Add gjs_context_gc() wrapper (1.43 KB, patch)
2011-09-16 14:43 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2011-09-16 14:43:44 UTC
See attached
Comment 1 Colin Walters 2011-09-16 14:43:47 UTC
Created attachment 196728 [details] [review]
context: Add optional signal emitted after a GC finishes

Embedders may want to perform garbage collection profiling; support
this with an optional signal emitted after a collection finishes.

I added a boolean to avoid calling JS_SetGCCallback() if not used,
because there's no way for that API to chain.
Comment 2 Colin Walters 2011-09-16 14:43:50 UTC
Created attachment 196729 [details] [review]
object: Run JS_updateMallocCounter() when creating GObjects

We need to ensure the garbage collector runs *sometime*.  It's easily
possible to make tiny proxies for large native objects with gjs.  Now,
Mozilla calls JS_updateMallocCounter() in a few places, namely the
Canvas stuff and when creating XPC proxies (roughly their GObject
equivalent).

This patch aims to match the latter one.
Comment 3 Colin Walters 2011-09-16 14:43:54 UTC
Created attachment 196730 [details] [review]
context: Add gjs_context_gc() wrapper

Simple wrapper for JS_GC() avoids simple embedders having to drop to
JSAPI.
Comment 4 drago01 2011-09-16 20:50:19 UTC
Review of attachment 196730 [details] [review]:

Makes sense.
Comment 5 Colin Walters 2011-09-17 14:04:50 UTC
Attachment 196728 [details] pushed as 20cfbeb - context: Add optional signal emitted after a GC finishes
Attachment 196729 [details] pushed as 72bc430 - object: Run JS_updateMallocCounter() when creating GObjects
Attachment 196730 [details] pushed as 059f6a1 - context: Add gjs_context_gc() wrapper
Comment 6 Jasper Lievisse Adriaanse 2011-09-27 17:45:16 UTC
What javascript library is being used that contains the JS_updateMallocCounter() function? One of the few google hits for this function was actually a report to remove this from the public API (https://bugzilla.mozilla.org/show_bug.cgi?id=525372).

Would it otherwise be somewhat ok to wrap the call in a #ifdef JS_updateMallocCounter block?