emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109187: Adjust consing_since_gc when


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109187: Adjust consing_since_gc when objects are explicitly freed.
Date: Sun, 22 Jul 2012 19:13:50 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109187
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Sun 2012-07-22 19:13:50 +0400
message:
  Adjust consing_since_gc when objects are explicitly freed.
  * alloc.c (GC_DEFAULT_THRESHOLD): New macro.
  (Fgarbage_collect): Use it.  Change minimum to 1/10 of default.
  (free_cons, free_misc): Subtract object size from consing_since_gc.
modified:
  src/ChangeLog
  src/alloc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-22 05:37:24 +0000
+++ b/src/ChangeLog     2012-07-22 15:13:50 +0000
@@ -1,5 +1,12 @@
 2012-07-22  Dmitry Antipov  <address@hidden>
 
+       Adjust consing_since_gc when objects are explicitly freed.
+       * alloc.c (GC_DEFAULT_THRESHOLD): New macro.
+       (Fgarbage_collect): Use it.  Change minimum to 1/10 of default.
+       (free_cons, free_misc): Subtract object size from consing_since_gc.
+
+2012-07-22  Dmitry Antipov  <address@hidden>
+
        Simplify and cleanup markers positioning code.
        * marker.c (attach_marker): More useful eassert.
        (live_buffer, set_marker_internal): New function.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-07-20 14:07:28 +0000
+++ b/src/alloc.c       2012-07-22 15:13:50 +0000
@@ -161,6 +161,10 @@
 
 #define GC_STRING_BYTES(S)     (STRING_BYTES (S))
 
+/* Default value of gc_cons_threshold (see below).  */
+
+#define GC_DEFAULT_THRESHOLD (100000 * sizeof (Lisp_Object))
+
 /* Global variables.  */
 struct emacs_globals globals;
 
@@ -2711,6 +2715,7 @@
   ptr->car = Vdead;
 #endif
   cons_free_list = ptr;
+  consing_since_gc -= sizeof *ptr;
   total_free_conses++;
 }
 
@@ -3606,7 +3611,7 @@
   XMISCTYPE (misc) = Lisp_Misc_Free;
   XMISC (misc)->u_free.chain = marker_free_list;
   marker_free_list = XMISC (misc);
-
+  consing_since_gc -= sizeof (union Lisp_Misc);
   total_free_markers++;
 }
 
@@ -5581,8 +5586,8 @@
   gc_in_progress = 0;
 
   consing_since_gc = 0;
-  if (gc_cons_threshold < 10000)
-    gc_cons_threshold = 10000;
+  if (gc_cons_threshold < GC_DEFAULT_THRESHOLD / 10)
+    gc_cons_threshold = GC_DEFAULT_THRESHOLD / 10;
 
   gc_relative_threshold = 0;
   if (FLOATP (Vgc_cons_percentage))
@@ -6731,7 +6736,7 @@
 #endif
 
   refill_memory_reserve ();
-  gc_cons_threshold = 100000 * sizeof (Lisp_Object);
+  gc_cons_threshold = GC_DEFAULT_THRESHOLD;
 }
 
 void


reply via email to

[Prev in Thread] Current Thread [Next in Thread]