emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/alloc.c


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/src/alloc.c
Date: Wed, 13 Jul 2005 01:28:37 -0400

Index: emacs/src/alloc.c
diff -c emacs/src/alloc.c:1.371 emacs/src/alloc.c:1.372
*** emacs/src/alloc.c:1.371     Mon Jul  4 16:06:28 2005
--- emacs/src/alloc.c   Wed Jul 13 05:28:37 2005
***************
*** 175,180 ****
--- 175,182 ----
  /* Number of bytes of consing since GC before another GC should be done. */
  
  EMACS_INT gc_cons_threshold;
+ EMACS_INT gc_cons_combined_threshold;
+ static Lisp_Object Vgc_cons_percentage;
  
  /* Nonzero during GC.  */
  
***************
*** 4897,4902 ****
--- 4899,4924 ----
    if (gc_cons_threshold < 10000)
      gc_cons_threshold = 10000;
  
+   gc_cons_combined_threshold = gc_cons_threshold;
+ 
+   if (FLOATP (Vgc_cons_percentage))
+     { /* Set gc_cons_combined_threshold.  */
+       EMACS_INT total = 0;
+       EMACS_INT threshold;
+       total += total_conses  * sizeof (struct Lisp_Cons);
+       total += total_symbols * sizeof (struct Lisp_Symbol);
+       total += total_markers * sizeof (union Lisp_Misc);
+       total += total_string_size;
+       total += total_vector_size * sizeof (Lisp_Object);
+       total += total_floats  * sizeof (struct Lisp_Float);
+       total += total_intervals * sizeof (struct interval);
+       total += total_strings * sizeof (struct Lisp_String);
+       
+       threshold = total * XFLOAT_DATA (Vgc_cons_percentage);
+       if (threshold > gc_cons_combined_threshold)
+       gc_cons_combined_threshold = threshold;
+     }
+ 
    if (garbage_collection_messages)
      {
        if (message_p || minibuf_level > 0)
***************
*** 5986,5991 ****
--- 6008,6014 ----
    staticidx = 0;
    consing_since_gc = 0;
    gc_cons_threshold = 100000 * sizeof (Lisp_Object);
+   gc_cons_combined_threshold = gc_cons_threshold;
  #ifdef VIRT_ADDR_VARIES
    malloc_sbrk_unused = 1<<22; /* A large number */
    malloc_sbrk_used = 100000;  /* as reasonable as any number */
***************
*** 6017,6023 ****
  Garbage collection happens automatically only when `eval' is called.
  
  By binding this temporarily to a large number, you can effectively
! prevent garbage collection during a part of the program.  */);
  
    DEFVAR_INT ("pure-bytes-used", &pure_bytes_used,
              doc: /* Number of bytes of sharable Lisp data allocated so far.  
*/);
--- 6040,6054 ----
  Garbage collection happens automatically only when `eval' is called.
  
  By binding this temporarily to a large number, you can effectively
! prevent garbage collection during a part of the program.
! See also `gc-cons-percentage'.  */);
! 
!   DEFVAR_LISP ("gc-cons-percentage", &Vgc_cons_percentage,
!              doc: /* *Portion of the heap used for allocation.
! Garbage collection can happen automatically once this portion of the heap
! has been allocated since the last garbage collection.
! If this portion is smaller than `gc-cons-threshold', this is ignored.  */);
!   Vgc_cons_percentage = make_float (0.1);
  
    DEFVAR_INT ("pure-bytes-used", &pure_bytes_used,
              doc: /* Number of bytes of sharable Lisp data allocated so far.  
*/);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]