[gnome-shell] Call shell_global_maybe_gc() when no work is being done



commit ce3f003e467781f55ceed2ad5accd7b6f212f93a
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Fri May 21 23:25:41 2010 +0200

    Call shell_global_maybe_gc() when no work is being done
    
    Call shell_global_maybe_gc when idle when no other work is ongoing to free
    up memory and improve performance by preventing the GC to kick in at less
    convenient times.
    
    See: https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_MaybeGC
    
    https://bugzilla.gnome.org/show_bug.cgi?id=614725

 src/shell-global.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/shell-global.c b/src/shell-global.c
index 11f0ee4..47ac928 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -1484,6 +1484,16 @@ run_leisure_functions (gpointer data)
   if (global->work_count > 0)
     return FALSE;
 
+  /*
+   * We do call MAYBE_GC() here to free up some memory and
+   * prevent the GC from running when we are busy doing other things.
+   */
+  shell_global_maybe_gc (global);
+
+  /* No leisure closures, so we are done */
+  if (global->leisure_closures == NULL)
+    return FALSE;
+
   closures = global->leisure_closures;
   global->leisure_closures = NULL;
 
@@ -1550,7 +1560,7 @@ shell_global_end_work (ShellGlobal *global)
   g_return_if_fail (global->work_count > 0);
 
   global->work_count--;
-  if (global->work_count == 0 && global->leisure_closures != NULL)
+  if (global->work_count == 0)
     schedule_leisure_functions (global);
 
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]