aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorRichard M. Stallman2005-07-23 19:08:06 +0000
committerRichard M. Stallman2005-07-23 19:08:06 +0000
commit974aae61bbb8c05e0d0fc1a95b419fe596423fd8 (patch)
treea8293b384dc0a9e175188159960dd2bffd4ddb76 /src/alloc.c
parentba6ebbd500397d924833ee8912f9f9b823731bab (diff)
downloademacs-974aae61bbb8c05e0d0fc1a95b419fe596423fd8.tar.gz
emacs-974aae61bbb8c05e0d0fc1a95b419fe596423fd8.zip
(gc_cons_threshold): Not static.
(gc_cons_combined_threshold): Var deleted. (gc_relative_threshold): New variable. (Fgarbage_collect, init_alloc_once): Compute gc_relative_threshold instead of gc_cons_combined_threshold.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/alloc.c b/src/alloc.c
index a65a96f1631..3c9b2199e52 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -172,10 +172,14 @@ EMACS_INT misc_objects_consed;
172EMACS_INT intervals_consed; 172EMACS_INT intervals_consed;
173EMACS_INT strings_consed; 173EMACS_INT strings_consed;
174 174
175/* Number of bytes of consing since GC before another GC should be done. */ 175/* Minimum number of bytes of consing since GC before next GC. */
176
177EMACS_INT gc_cons_threshold;
178
179/* Similar minimum, computed from Vgc_cons_percentage. */
180
181EMACS_INT gc_relative_threshold;
176 182
177static EMACS_INT gc_cons_threshold;
178EMACS_INT gc_cons_combined_threshold;
179static Lisp_Object Vgc_cons_percentage; 183static Lisp_Object Vgc_cons_percentage;
180 184
181/* Nonzero during GC. */ 185/* Nonzero during GC. */
@@ -4899,12 +4903,10 @@ returns nil, because real GC can't be done. */)
4899 if (gc_cons_threshold < 10000) 4903 if (gc_cons_threshold < 10000)
4900 gc_cons_threshold = 10000; 4904 gc_cons_threshold = 10000;
4901 4905
4902 gc_cons_combined_threshold = gc_cons_threshold;
4903
4904 if (FLOATP (Vgc_cons_percentage)) 4906 if (FLOATP (Vgc_cons_percentage))
4905 { /* Set gc_cons_combined_threshold. */ 4907 { /* Set gc_cons_combined_threshold. */
4906 EMACS_INT total = 0; 4908 EMACS_INT total = 0;
4907 EMACS_INT threshold; 4909
4908 total += total_conses * sizeof (struct Lisp_Cons); 4910 total += total_conses * sizeof (struct Lisp_Cons);
4909 total += total_symbols * sizeof (struct Lisp_Symbol); 4911 total += total_symbols * sizeof (struct Lisp_Symbol);
4910 total += total_markers * sizeof (union Lisp_Misc); 4912 total += total_markers * sizeof (union Lisp_Misc);
@@ -4914,10 +4916,10 @@ returns nil, because real GC can't be done. */)
4914 total += total_intervals * sizeof (struct interval); 4916 total += total_intervals * sizeof (struct interval);
4915 total += total_strings * sizeof (struct Lisp_String); 4917 total += total_strings * sizeof (struct Lisp_String);
4916 4918
4917 threshold = total * XFLOAT_DATA (Vgc_cons_percentage); 4919 gc_relative_threshold = total * XFLOAT_DATA (Vgc_cons_percentage);
4918 if (threshold > gc_cons_combined_threshold)
4919 gc_cons_combined_threshold = threshold;
4920 } 4920 }
4921 else
4922 gc_relative_threshold = 0;
4921 4923
4922 if (garbage_collection_messages) 4924 if (garbage_collection_messages)
4923 { 4925 {
@@ -6008,7 +6010,8 @@ init_alloc_once ()
6008 staticidx = 0; 6010 staticidx = 0;
6009 consing_since_gc = 0; 6011 consing_since_gc = 0;
6010 gc_cons_threshold = 100000 * sizeof (Lisp_Object); 6012 gc_cons_threshold = 100000 * sizeof (Lisp_Object);
6011 gc_cons_combined_threshold = gc_cons_threshold; 6013 gc_relative_threshold = 0;
6014
6012#ifdef VIRT_ADDR_VARIES 6015#ifdef VIRT_ADDR_VARIES
6013 malloc_sbrk_unused = 1<<22; /* A large number */ 6016 malloc_sbrk_unused = 1<<22; /* A large number */
6014 malloc_sbrk_used = 100000; /* as reasonable as any number */ 6017 malloc_sbrk_used = 100000; /* as reasonable as any number */