diff options
| author | Miles Bader | 2005-07-14 08:02:00 +0000 |
|---|---|---|
| committer | Miles Bader | 2005-07-14 08:02:00 +0000 |
| commit | bacb9790f594207469f22ed9f3e8085ab76e5e2b (patch) | |
| tree | b1cee62715d6cd2797f3122e4f058d7bc18ceef6 /src/alloc.c | |
| parent | d3e4babdd1267fb5690a17949196640a47c6f159 (diff) | |
| parent | ead25b5cabbe092711864eae13a76437e6a65ce1 (diff) | |
| download | emacs-bacb9790f594207469f22ed9f3e8085ab76e5e2b.tar.gz emacs-bacb9790f594207469f22ed9f3e8085ab76e5e2b.zip | |
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
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/alloc.c b/src/alloc.c index 26d41c12b50..5c5252b1ba1 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -174,7 +174,9 @@ 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 | ||
| @@ -4854,6 +4856,26 @@ returns nil, because real GC can't be done. */) | |||
| 4854 | if (gc_cons_threshold < 10000) | 4856 | if (gc_cons_threshold < 10000) |
| 4855 | gc_cons_threshold = 10000; | 4857 | gc_cons_threshold = 10000; |
| 4856 | 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 | } | ||
| 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) |
| @@ -5943,6 +5965,7 @@ init_alloc_once () | |||
| 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 */ |
| @@ -5974,7 +5997,15 @@ allocated since the last garbage collection. All data types count. | |||
| 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. */); |