[gnome-shell] global: Initiate *full* GC at idle



commit f54b82f64c2f0553b0df24678c188e0d2144af52
Author: Colin Walters <walters verbum org>
Date:   Fri Sep 16 10:37:59 2011 -0400

    global: Initiate *full* GC at idle
    
    While I've been trying to make the GC kick in more often, I've decided
    it's a better tradeoff to aggressively GC at "leisure", for multiple
    reasons.
    
    We can and should revisit this at a later time, but basically:
    
    * The shell doesn't generate *that* much JS data - garbage collection
      is very fast here.
    * Long periods without GC mean we're not calling free() when we
      could, which in turn makes heap fragmentation much worse.
    * Ensuring the GC runs at idle makes it much less likely we'll take
      a random large GC hit in the middle of an animation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=659254

 src/shell-global.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/shell-global.c b/src/shell-global.c
index 98b51be..bf7b5a7 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -1429,11 +1429,12 @@ 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.
+  /* 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.
    */
-  shell_global_maybe_gc (global);
+  gjs_context_gc (global->js_context);
 
   /* No leisure closures, so we are done */
   if (global->leisure_closures == NULL)



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