diff options
| author | Karoly Lorentey | 2004-05-27 17:24:17 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-05-27 17:24:17 +0000 |
| commit | 4e1bb54039da0e3d5c84e231104703d62ace938d (patch) | |
| tree | f5bfbeec2c631db3e1a8de4aa3bfe37220580cad /src/alloc.c | |
| parent | f76e7db651b005bb697a188e4fe684fe25e29601 (diff) | |
| parent | 6c0afe12c98f63cc694e9fae5a05e5fd18afa636 (diff) | |
| download | emacs-4e1bb54039da0e3d5c84e231104703d62ace938d.tar.gz emacs-4e1bb54039da0e3d5c84e231104703d62ace938d.zip | |
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-342
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-343
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-178
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/alloc.c b/src/alloc.c index ae156d89f24..1d50f19e921 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -2866,6 +2866,10 @@ int marker_block_index; | |||
| 2866 | 2866 | ||
| 2867 | union Lisp_Misc *marker_free_list; | 2867 | union Lisp_Misc *marker_free_list; |
| 2868 | 2868 | ||
| 2869 | /* Marker blocks which should be freed at end of GC. */ | ||
| 2870 | |||
| 2871 | struct marker_block *marker_blocks_pending_free; | ||
| 2872 | |||
| 2869 | /* Total number of marker blocks now in use. */ | 2873 | /* Total number of marker blocks now in use. */ |
| 2870 | 2874 | ||
| 2871 | int n_marker_blocks; | 2875 | int n_marker_blocks; |
| @@ -2876,6 +2880,7 @@ init_marker () | |||
| 2876 | marker_block = NULL; | 2880 | marker_block = NULL; |
| 2877 | marker_block_index = MARKER_BLOCK_SIZE; | 2881 | marker_block_index = MARKER_BLOCK_SIZE; |
| 2878 | marker_free_list = 0; | 2882 | marker_free_list = 0; |
| 2883 | marker_blocks_pending_free = 0; | ||
| 2879 | n_marker_blocks = 0; | 2884 | n_marker_blocks = 0; |
| 2880 | } | 2885 | } |
| 2881 | 2886 | ||
| @@ -4531,6 +4536,18 @@ returns nil, because real GC can't be done. */) | |||
| 4531 | } | 4536 | } |
| 4532 | } | 4537 | } |
| 4533 | 4538 | ||
| 4539 | /* Undo lists have been cleaned up, so we can free marker blocks now. */ | ||
| 4540 | |||
| 4541 | { | ||
| 4542 | struct marker_block *mblk; | ||
| 4543 | |||
| 4544 | while ((mblk = marker_blocks_pending_free) != 0) | ||
| 4545 | { | ||
| 4546 | marker_blocks_pending_free = mblk->next; | ||
| 4547 | lisp_free (mblk); | ||
| 4548 | } | ||
| 4549 | } | ||
| 4550 | |||
| 4534 | /* Clear the mark bits that we set in certain root slots. */ | 4551 | /* Clear the mark bits that we set in certain root slots. */ |
| 4535 | 4552 | ||
| 4536 | unmark_byte_stack (); | 4553 | unmark_byte_stack (); |
| @@ -5439,6 +5456,7 @@ gc_sweep () | |||
| 5439 | register int num_free = 0, num_used = 0; | 5456 | register int num_free = 0, num_used = 0; |
| 5440 | 5457 | ||
| 5441 | marker_free_list = 0; | 5458 | marker_free_list = 0; |
| 5459 | marker_blocks_pending_free = 0; | ||
| 5442 | 5460 | ||
| 5443 | for (mblk = marker_block; mblk; mblk = *mprev) | 5461 | for (mblk = marker_block; mblk; mblk = *mprev) |
| 5444 | { | 5462 | { |
| @@ -5469,19 +5487,20 @@ gc_sweep () | |||
| 5469 | /* If this block contains only free markers and we have already | 5487 | /* If this block contains only free markers and we have already |
| 5470 | seen more than two blocks worth of free markers then deallocate | 5488 | seen more than two blocks worth of free markers then deallocate |
| 5471 | this block. */ | 5489 | this block. */ |
| 5472 | #if 0 | ||
| 5473 | /* There may still be pointers to these markers from a buffer's | ||
| 5474 | undo list, so don't free them. KFS 2004-05-21 / | ||
| 5475 | if (this_free == MARKER_BLOCK_SIZE && num_free > MARKER_BLOCK_SIZE) | 5490 | if (this_free == MARKER_BLOCK_SIZE && num_free > MARKER_BLOCK_SIZE) |
| 5476 | { | 5491 | { |
| 5477 | *mprev = mblk->next; | 5492 | *mprev = mblk->next; |
| 5478 | /* Unhook from the free list. */ | 5493 | /* Unhook from the free list. */ |
| 5479 | marker_free_list = mblk->markers[0].u_free.chain; | 5494 | marker_free_list = mblk->markers[0].u_free.chain; |
| 5480 | lisp_free (mblk); | ||
| 5481 | n_marker_blocks--; | 5495 | n_marker_blocks--; |
| 5496 | |||
| 5497 | /* It is not safe to free the marker block at this stage, | ||
| 5498 | since there may still be pointers to these markers from | ||
| 5499 | a buffer's undo list. KFS 2004-05-25. */ | ||
| 5500 | mblk->next = marker_blocks_pending_free; | ||
| 5501 | marker_blocks_pending_free = mblk; | ||
| 5482 | } | 5502 | } |
| 5483 | else | 5503 | else |
| 5484 | #endif | ||
| 5485 | { | 5504 | { |
| 5486 | num_free += this_free; | 5505 | num_free += this_free; |
| 5487 | mprev = &mblk->next; | 5506 | mprev = &mblk->next; |