GNOME Bugzilla – Bug 659253
memory patches
Last modified: 2011-09-27 17:45:16 UTC
See attached
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.
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.
Created attachment 196730 [details] [review] context: Add gjs_context_gc() wrapper Simple wrapper for JS_GC() avoids simple embedders having to drop to JSAPI.
Review of attachment 196730 [details] [review]: Makes sense.
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
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?