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: Andrew Innes
Subject: [Emacs-diffs] Changes to emacs/src/alloc.c
Date: Wed, 05 Dec 2001 16:37:49 -0500

Index: emacs/src/alloc.c
diff -c emacs/src/alloc.c:1.255 emacs/src/alloc.c:1.256
*** emacs/src/alloc.c:1.255     Tue Nov 13 01:55:14 2001
--- emacs/src/alloc.c   Wed Dec  5 16:37:48 2001
***************
*** 1020,1026 ****
  
  /* Lisp_Strings are allocated in string_block structures.  When a new
     string_block is allocated, all the Lisp_Strings it contains are
!    added to a free-list stiing_free_list.  When a new Lisp_String is
     needed, it is taken from that list.  During the sweep phase of GC,
     string_blocks that are entirely free are freed, except two which
     we keep.
--- 1020,1026 ----
  
  /* Lisp_Strings are allocated in string_block structures.  When a new
     string_block is allocated, all the Lisp_Strings it contains are
!    added to a free-list string_free_list.  When a new Lisp_String is
     needed, it is taken from that list.  During the sweep phase of GC,
     string_blocks that are entirely free are freed, except two which
     we keep.
***************
*** 4096,4101 ****
--- 4096,4119 ----
          nextb->undo_list 
            = truncate_undo_list (nextb->undo_list, undo_limit,
                                  undo_strong_limit);
+ 
+       /* Shrink buffer gaps, but skip indirect and dead buffers.  */
+       if (nextb->base_buffer == 0 && !NILP (nextb->name))
+         {
+           /* If a buffer's gap size is more than 10% of the buffer
+              size, or larger than 2000 bytes, then shrink it
+              accordingly.  Keep a minimum size of 20 bytes.  */
+           int size = min (2000, max (20, (nextb->text->z_byte / 10)));
+ 
+           if (nextb->text->gap_size > size)
+             {
+               struct buffer *save_current = current_buffer;
+               current_buffer = nextb;
+               make_gap (-(nextb->text->gap_size - size));
+               current_buffer = save_current;
+             }
+         }
+ 
        nextb = nextb->next;
        }
    }



reply via email to

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