summaryrefslogtreecommitdiff
path: root/community/cinnamon/remove_GC.patch
blob: 7bd8e45a6a9a2ced7b1829b724286a60adc434c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
--- 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) {