--- a/src/cinnamon-global.c +++ b/src/cinnamon-global.c @@ -1399,35 +1399,6 @@ cinnamon_global_reexec_self (CinnamonGlo g_ptr_array_free (arr, TRUE); } -/** - * cinnamon_global_gc: - * @global: A #CinnamonGlobal - * - * Start a garbage collection process. For more information, see - * https://developer.mozilla.org/En/JS_GC - */ -void -cinnamon_global_gc (CinnamonGlobal *global) -{ - JSContext *context = gjs_context_get_native_context (global->js_context); - - JS_GC (context); -} - -/** - * cinnamon_global_maybe_gc: - * @global: A #CinnamonGlobal - * - * Start a garbage collection process when it would free up enough memory - * to be worth the amount of time it would take - * https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_MaybeGC - */ -void -cinnamon_global_maybe_gc (CinnamonGlobal *global) -{ - gjs_context_maybe_gc (global->js_context); -} - static void cinnamon_global_on_gc (GjsContext *context, CinnamonGlobal *global) @@ -1768,13 +1768,6 @@ run_leisure_functions (gpointer data) if (global->work_count > 0) return FALSE; - /* Previously we called gjs_maybe_gc(). However, it simply doesn't - * trigger often enough. Garbage collection is very fast here, so - * let's just aggressively GC. This will help avoid both heap - * fragmentation, and the GC kicking in when we don't want it to. - */ - gjs_context_gc (global->js_context); - /* No leisure closures, so we are done */ if (global->leisure_closures == NULL) return FALSE; --- a/src/cinnamon-global.h +++ b/src/cinnamon-global.h @@ -88,10 +88,6 @@ void cinnamon_global_set_pointer int y); -/* JavaScript utilities */ -void cinnamon_global_gc (CinnamonGlobal *global); -void cinnamon_global_maybe_gc (CinnamonGlobal *global); - typedef struct { guint glibc_uordblks; --- a/js/perf/core.js +++ b/js/perf/core.js @@ -1,5 +1,7 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- +const System = imports.system; + const Main = imports.ui.main; const Scripting = imports.ui.scripting; @@ -99,7 +101,7 @@ function run() { Main.overview.hide(); yield Scripting.waitLeisure(); - global.gc(); + System.gc(); yield Scripting.sleep(1000); Scripting.collectStatistics(); Scripting.scriptEvent('afterShowHide'); --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -11,6 +11,7 @@ const St = imports.gi.St; const Cinnamon = imports.gi.Cinnamon; const Signals = imports.signals; const Lang = imports.lang; +const System = imports.system; const History = imports.misc.history; const Extension = imports.ui.extension; @@ -680,7 +681,7 @@ Memory.prototype = { this._gcbutton = new St.Button({ label: 'Full GC', style_class: 'lg-obj-inspector-button' }); - this._gcbutton.connect('clicked', Lang.bind(this, function () { global.gc(); this._renderText(); })); + this._gcbutton.connect('clicked', Lang.bind(this, function () { System.gc(); this._renderText(); })); this.actor.add(this._gcbutton, { x_align: St.Align.START, x_fill: false }); --- a/js/ui/lookingGlassDBus.js +++ b/js/ui/lookingGlassDBus.js @@ -1,5 +1,7 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- +const System = imports.system; + const Gio = imports.gi.Gio; const Main = imports.ui.main; const Extension = imports.ui.extension; @@ -99,7 +101,7 @@ CinnamonLookingGlass.prototype = { }, FullGc: function() { - global.gc(); + System.gc(); }, Inspect: function(path) {