comparison src/alloc.c @ 90201:fbb2bea03df9

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-69 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 474-484) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 88-91) - Merge from emacs--cvs-trunk--0 - Update FSF's address in GPL notices - Update from CVS
author Miles Bader <miles@gnu.org>
date Thu, 14 Jul 2005 08:02:00 +0000
parents f9a65d7ebd29 ce14666827c6
children 890cc78a5a24
comparison
equal deleted inserted replaced
90200:f9a65d7ebd29 90201:fbb2bea03df9
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 /* Number of bytes of consing since GC before another GC should be done. */
176 176
177 EMACS_INT gc_cons_threshold; 177 static EMACS_INT gc_cons_threshold;
178 EMACS_INT gc_cons_combined_threshold;
179 static Lisp_Object Vgc_cons_percentage;
178 180
179 /* Nonzero during GC. */ 181 /* Nonzero during GC. */
180 182
181 int gc_in_progress; 183 int gc_in_progress;
182 184
4851 gc_in_progress = 0; 4853 gc_in_progress = 0;
4852 4854
4853 consing_since_gc = 0; 4855 consing_since_gc = 0;
4854 if (gc_cons_threshold < 10000) 4856 if (gc_cons_threshold < 10000)
4855 gc_cons_threshold = 10000; 4857 gc_cons_threshold = 10000;
4858
4859 gc_cons_combined_threshold = gc_cons_threshold;
4860
4861 if (FLOATP (Vgc_cons_percentage))
4862 { /* Set gc_cons_combined_threshold. */
4863 EMACS_INT total = 0;
4864 EMACS_INT threshold;
4865 total += total_conses * sizeof (struct Lisp_Cons);
4866 total += total_symbols * sizeof (struct Lisp_Symbol);
4867 total += total_markers * sizeof (union Lisp_Misc);
4868 total += total_string_size;
4869 total += total_vector_size * sizeof (Lisp_Object);
4870 total += total_floats * sizeof (struct Lisp_Float);
4871 total += total_intervals * sizeof (struct interval);
4872 total += total_strings * sizeof (struct Lisp_String);
4873
4874 threshold = total * XFLOAT_DATA (Vgc_cons_percentage);
4875 if (threshold > gc_cons_combined_threshold)
4876 gc_cons_combined_threshold = threshold;
4877 }
4856 4878
4857 if (garbage_collection_messages) 4879 if (garbage_collection_messages)
4858 { 4880 {
4859 if (message_p || minibuf_level > 0) 4881 if (message_p || minibuf_level > 0)
4860 restore_message (); 4882 restore_message ();
5941 gcprolist = 0; 5963 gcprolist = 0;
5942 byte_stack_list = 0; 5964 byte_stack_list = 0;
5943 staticidx = 0; 5965 staticidx = 0;
5944 consing_since_gc = 0; 5966 consing_since_gc = 0;
5945 gc_cons_threshold = 100000 * sizeof (Lisp_Object); 5967 gc_cons_threshold = 100000 * sizeof (Lisp_Object);
5968 gc_cons_combined_threshold = gc_cons_threshold;
5946 #ifdef VIRT_ADDR_VARIES 5969 #ifdef VIRT_ADDR_VARIES
5947 malloc_sbrk_unused = 1<<22; /* A large number */ 5970 malloc_sbrk_unused = 1<<22; /* A large number */
5948 malloc_sbrk_used = 100000; /* as reasonable as any number */ 5971 malloc_sbrk_used = 100000; /* as reasonable as any number */
5949 #endif /* VIRT_ADDR_VARIES */ 5972 #endif /* VIRT_ADDR_VARIES */
5950 } 5973 }
5972 allocated since the last garbage collection. All data types count. 5995 allocated since the last garbage collection. All data types count.
5973 5996
5974 Garbage collection happens automatically only when `eval' is called. 5997 Garbage collection happens automatically only when `eval' is called.
5975 5998
5976 By binding this temporarily to a large number, you can effectively 5999 By binding this temporarily to a large number, you can effectively
5977 prevent garbage collection during a part of the program. */); 6000 prevent garbage collection during a part of the program.
6001 See also `gc-cons-percentage'. */);
6002
6003 DEFVAR_LISP ("gc-cons-percentage", &Vgc_cons_percentage,
6004 doc: /* *Portion of the heap used for allocation.
6005 Garbage collection can happen automatically once this portion of the heap
6006 has been allocated since the last garbage collection.
6007 If this portion is smaller than `gc-cons-threshold', this is ignored. */);
6008 Vgc_cons_percentage = make_float (0.1);
5978 6009
5979 DEFVAR_INT ("pure-bytes-used", &pure_bytes_used, 6010 DEFVAR_INT ("pure-bytes-used", &pure_bytes_used,
5980 doc: /* Number of bytes of sharable Lisp data allocated so far. */); 6011 doc: /* Number of bytes of sharable Lisp data allocated so far. */);
5981 6012
5982 DEFVAR_INT ("cons-cells-consed", &cons_cells_consed, 6013 DEFVAR_INT ("cons-cells-consed", &cons_cells_consed,