aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
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 5c5252b1ba1..35bdfc8a93a 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. */
@@ -4856,12 +4860,10 @@ returns nil, because real GC can't be done. */)
4856 if (gc_cons_threshold < 10000) 4860 if (gc_cons_threshold < 10000)
4857 gc_cons_threshold = 10000; 4861 gc_cons_threshold = 10000;
4858 4862
4859 gc_cons_combined_threshold = gc_cons_threshold;
4860
4861 if (FLOATP (Vgc_cons_percentage)) 4863 if (FLOATP (Vgc_cons_percentage))
4862 { /* Set gc_cons_combined_threshold. */ 4864 { /* Set gc_cons_combined_threshold. */
4863 EMACS_INT total = 0; 4865 EMACS_INT total = 0;
4864 EMACS_INT threshold; 4866
4865 total += total_conses * sizeof (struct Lisp_Cons); 4867 total += total_conses * sizeof (struct Lisp_Cons);
4866 total += total_symbols * sizeof (struct Lisp_Symbol); 4868 total += total_symbols * sizeof (struct Lisp_Symbol);
4867 total += total_markers * sizeof (union Lisp_Misc); 4869 total += total_markers * sizeof (union Lisp_Misc);
@@ -4871,10 +4873,10 @@ returns nil, because real GC can't be done. */)
4871 total += total_intervals * sizeof (struct interval); 4873 total += total_intervals * sizeof (struct interval);
4872 total += total_strings * sizeof (struct Lisp_String); 4874 total += total_strings * sizeof (struct Lisp_String);
4873 4875
4874 threshold = total * XFLOAT_DATA (Vgc_cons_percentage); 4876 gc_relative_threshold = total * XFLOAT_DATA (Vgc_cons_percentage);
4875 if (threshold > gc_cons_combined_threshold)
4876 gc_cons_combined_threshold = threshold;
4877 } 4877 }
4878 else
4879 gc_relative_threshold = 0;
4878 4880
4879 if (garbage_collection_messages) 4881 if (garbage_collection_messages)
4880 { 4882 {
@@ -5965,7 +5967,8 @@ init_alloc_once ()
5965 staticidx = 0; 5967 staticidx = 0;
5966 consing_since_gc = 0; 5968 consing_since_gc = 0;
5967 gc_cons_threshold = 100000 * sizeof (Lisp_Object); 5969 gc_cons_threshold = 100000 * sizeof (Lisp_Object);
5968 gc_cons_combined_threshold = gc_cons_threshold; 5970 gc_relative_threshold = 0;
5971
5969#ifdef VIRT_ADDR_VARIES 5972#ifdef VIRT_ADDR_VARIES
5970 malloc_sbrk_unused = 1<<22; /* A large number */ 5973 malloc_sbrk_unused = 1<<22; /* A large number */
5971 malloc_sbrk_used = 100000; /* as reasonable as any number */ 5974 malloc_sbrk_used = 100000; /* as reasonable as any number */