comparison src/alloc.c @ 64611:47f158dcf216

(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.
author Richard M. Stallman <rms@gnu.org>
date Sat, 23 Jul 2005 19:08:06 +0000
parents ce14666827c6
children 375ab086d366 532e0a9335a9 890cc78a5a24
comparison
equal deleted inserted replaced
64610:06bf5258607d 64611:47f158dcf216
170 EMACS_INT string_chars_consed; 170 EMACS_INT string_chars_consed;
171 EMACS_INT misc_objects_consed; 171 EMACS_INT misc_objects_consed;
172 EMACS_INT intervals_consed; 172 EMACS_INT intervals_consed;
173 EMACS_INT strings_consed; 173 EMACS_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 176
177 static EMACS_INT gc_cons_threshold; 177 EMACS_INT gc_cons_threshold;
178 EMACS_INT gc_cons_combined_threshold; 178
179 /* Similar minimum, computed from Vgc_cons_percentage. */
180
181 EMACS_INT gc_relative_threshold;
182
179 static Lisp_Object Vgc_cons_percentage; 183 static Lisp_Object Vgc_cons_percentage;
180 184
181 /* Nonzero during GC. */ 185 /* Nonzero during GC. */
182 186
183 int gc_in_progress; 187 int gc_in_progress;
4897 4901
4898 consing_since_gc = 0; 4902 consing_since_gc = 0;
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);
4911 total += total_string_size; 4913 total += total_string_size;
4912 total += total_vector_size * sizeof (Lisp_Object); 4914 total += total_vector_size * sizeof (Lisp_Object);
4913 total += total_floats * sizeof (struct Lisp_Float); 4915 total += total_floats * sizeof (struct Lisp_Float);
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) 4920 }
4919 gc_cons_combined_threshold = threshold; 4921 else
4920 } 4922 gc_relative_threshold = 0;
4921 4923
4922 if (garbage_collection_messages) 4924 if (garbage_collection_messages)
4923 { 4925 {
4924 if (message_p || minibuf_level > 0) 4926 if (message_p || minibuf_level > 0)
4925 restore_message (); 4927 restore_message ();
6006 gcprolist = 0; 6008 gcprolist = 0;
6007 byte_stack_list = 0; 6009 byte_stack_list = 0;
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 */
6015 #endif /* VIRT_ADDR_VARIES */ 6018 #endif /* VIRT_ADDR_VARIES */
6016 } 6019 }