Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
e0fead5d
Commit
e0fead5d
authored
Dec 05, 2001
by
Andrew Innes
Browse files
(Fgarbage_collect): Shrink buffer gaps that are
excessively large.
parent
8af5b8e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
src/ChangeLog
src/ChangeLog
+10
-0
src/alloc.c
src/alloc.c
+19
-1
No files found.
src/ChangeLog
View file @
e0fead5d
2001-12-05 Andrew Innes <andrewi@gnu.org>
* alloc.c (Fgarbage_collect): Shrink buffer gaps that are
excessively large.
* insdel.c (make_gap_larger): New function.
(make_gap_smaller): New function.
(make_gap) [USE_MMAP_FOR_BUFFERS || REL_ALLOC]: Call
make_gap_smaller if arg is negative.
2001-12-04 Stefan Monnier <monnier@cs.yale.edu>
* keyboard.c (kbd_buffer_store_event): Fix interrupt_signal prototype.
...
...
src/alloc.c
View file @
e0fead5d
...
...
@@ -1020,7 +1020,7 @@ make_number (n)
/* 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 st
i
ing_free_list. When a new Lisp_String is
added to a free-list st
r
ing_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,6 +4096,24 @@ Garbage collection happens automatically if you cons more than
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
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment