aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorKaroly Lorentey2005-02-03 23:28:36 +0000
committerKaroly Lorentey2005-02-03 23:28:36 +0000
commit597cfb3fbc57114062f12dfdfa37c0157fff1e97 (patch)
treedea42300f641805b707eb9a64035acac8c9f547e /src/alloc.c
parentfd41924555942f6c3c1e12400ab313717a3818cd (diff)
parent4e07258f2b539fa9a3ba97442e81e3e67a9ce5a7 (diff)
downloademacs-597cfb3fbc57114062f12dfdfa37c0157fff1e97.tar.gz
emacs-597cfb3fbc57114062f12dfdfa37c0157fff1e97.zip
Merged in changes from CVS trunk. (Long time no see!) :-)
Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-83 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-84 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-1 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-2 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-3 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-4 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-5 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-6 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-7 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-8 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-9 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-10 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-11 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-12 Remove "-face" suffix from lazy-highlight face name * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-13 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-14 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-15 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-16 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-17 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-18 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-19 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-20 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-21 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-22 <no summary provided> * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-23 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-24 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-25 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-26 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-27 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-28 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-29 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-30 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-31 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-32 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-33 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-34 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-35 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-36 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-37 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-38 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-39 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-40 Fix regressions from latest reftex update * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-41 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-42 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-43 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-44 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-45 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-46 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-47 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-48 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-49 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-50 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-51 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-52 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-53 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-54 Update from CVS: lisp/cus-start.el (all): Add `undo-outer-limit'. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-55 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-56 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-57 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-58 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-59 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-60 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-61 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-62 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-63 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-64 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-65 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-66 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-67 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-68 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-69 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-70 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-71 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-72 src/dispextern.h (xassert): Enable unconditionally. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-73 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-74 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-75 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--base-0 tag of miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-82 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-1 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-2 Merge from miles@gnu.org--gnu-2004 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-3 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-4 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-5 Update from CVS: exi/gnus-faq.texi ([4.1]): Typo. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-6 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-7 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-8 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-9 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-10 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-11 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-281
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/src/alloc.c b/src/alloc.c
index eabbf5192f4..49fc69e7058 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -103,7 +103,7 @@ extern __malloc_size_t __malloc_extra_blocks;
103 that the backend handles concurrent access to malloc within its own threads 103 that the backend handles concurrent access to malloc within its own threads
104 but Emacs code running in the main thread is not included in that control). 104 but Emacs code running in the main thread is not included in that control).
105 105
106 When UNBLOCK_INPUT is called, revoke_input_signal may be called. If this 106 When UNBLOCK_INPUT is called, reinvoke_input_signal may be called. If this
107 happens in one of the backend threads we will have two threads that tries 107 happens in one of the backend threads we will have two threads that tries
108 to run Emacs code at once, and the code is not prepared for that. 108 to run Emacs code at once, and the code is not prepared for that.
109 To prevent that, we only call BLOCK/UNBLOCK from the main thread. */ 109 To prevent that, we only call BLOCK/UNBLOCK from the main thread. */
@@ -143,11 +143,11 @@ static __malloc_size_t bytes_used_when_full;
143 143
144#define MARK_STRING(S) ((S)->size |= ARRAY_MARK_FLAG) 144#define MARK_STRING(S) ((S)->size |= ARRAY_MARK_FLAG)
145#define UNMARK_STRING(S) ((S)->size &= ~ARRAY_MARK_FLAG) 145#define UNMARK_STRING(S) ((S)->size &= ~ARRAY_MARK_FLAG)
146#define STRING_MARKED_P(S) ((S)->size & ARRAY_MARK_FLAG) 146#define STRING_MARKED_P(S) (((S)->size & ARRAY_MARK_FLAG) != 0)
147 147
148#define VECTOR_MARK(V) ((V)->size |= ARRAY_MARK_FLAG) 148#define VECTOR_MARK(V) ((V)->size |= ARRAY_MARK_FLAG)
149#define VECTOR_UNMARK(V) ((V)->size &= ~ARRAY_MARK_FLAG) 149#define VECTOR_UNMARK(V) ((V)->size &= ~ARRAY_MARK_FLAG)
150#define VECTOR_MARKED_P(V) ((V)->size & ARRAY_MARK_FLAG) 150#define VECTOR_MARKED_P(V) (((V)->size & ARRAY_MARK_FLAG) != 0)
151 151
152/* Value is the number of bytes/chars of S, a pointer to a struct 152/* Value is the number of bytes/chars of S, a pointer to a struct
153 Lisp_String. This must be used instead of STRING_BYTES (S) or 153 Lisp_String. This must be used instead of STRING_BYTES (S) or
@@ -310,6 +310,7 @@ static void mark_glyph_matrix P_ ((struct glyph_matrix *));
310static void mark_face_cache P_ ((struct face_cache *)); 310static void mark_face_cache P_ ((struct face_cache *));
311 311
312#ifdef HAVE_WINDOW_SYSTEM 312#ifdef HAVE_WINDOW_SYSTEM
313extern void mark_fringe_data P_ ((void));
313static void mark_image P_ ((struct image *)); 314static void mark_image P_ ((struct image *));
314static void mark_image_cache P_ ((struct frame *)); 315static void mark_image_cache P_ ((struct frame *));
315#endif /* HAVE_WINDOW_SYSTEM */ 316#endif /* HAVE_WINDOW_SYSTEM */
@@ -705,9 +706,14 @@ overrun_check_free (block)
705 val + osize, 706 val + osize,
706 XMALLOC_OVERRUN_CHECK_SIZE)) 707 XMALLOC_OVERRUN_CHECK_SIZE))
707 abort (); 708 abort ();
709#ifdef XMALLOC_CLEAR_FREE_MEMORY
710 val -= XMALLOC_OVERRUN_CHECK_SIZE;
711 memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2);
712#else
708 bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); 713 bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE);
709 val -= XMALLOC_OVERRUN_CHECK_SIZE; 714 val -= XMALLOC_OVERRUN_CHECK_SIZE;
710 bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); 715 bzero (val, XMALLOC_OVERRUN_CHECK_SIZE);
716#endif
711 } 717 }
712 718
713 free (val); 719 free (val);
@@ -1114,17 +1120,34 @@ allocate_buffer ()
1114} 1120}
1115 1121
1116 1122
1123#ifndef SYSTEM_MALLOC
1124
1125/* If we released our reserve (due to running out of memory),
1126 and we have a fair amount free once again,
1127 try to set aside another reserve in case we run out once more.
1128
1129 This is called when a relocatable block is freed in ralloc.c. */
1130
1131void
1132refill_memory_reserve ()
1133{
1134 if (spare_memory == 0)
1135 spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
1136}
1137
1138
1117/* Arranging to disable input signals while we're in malloc. 1139/* Arranging to disable input signals while we're in malloc.
1118 1140
1119 This only works with GNU malloc. To help out systems which can't 1141 This only works with GNU malloc. To help out systems which can't
1120 use GNU malloc, all the calls to malloc, realloc, and free 1142 use GNU malloc, all the calls to malloc, realloc, and free
1121 elsewhere in the code should be inside a BLOCK_INPUT/UNBLOCK_INPUT 1143 elsewhere in the code should be inside a BLOCK_INPUT/UNBLOCK_INPUT
1122 pairs; unfortunately, we have no idea what C library functions 1144 pair; unfortunately, we have no idea what C library functions
1123 might call malloc, so we can't really protect them unless you're 1145 might call malloc, so we can't really protect them unless you're
1124 using GNU malloc. Fortunately, most of the major operating systems 1146 using GNU malloc. Fortunately, most of the major operating systems
1125 can use GNU malloc. */ 1147 can use GNU malloc. */
1126 1148
1127#ifndef SYSTEM_MALLOC 1149#ifndef SYNC_INPUT
1150
1128#ifndef DOUG_LEA_MALLOC 1151#ifndef DOUG_LEA_MALLOC
1129extern void * (*__malloc_hook) P_ ((size_t)); 1152extern void * (*__malloc_hook) P_ ((size_t));
1130extern void * (*__realloc_hook) P_ ((void *, size_t)); 1153extern void * (*__realloc_hook) P_ ((void *, size_t));
@@ -1183,20 +1206,6 @@ emacs_blocked_free (ptr)
1183} 1206}
1184 1207
1185 1208
1186/* If we released our reserve (due to running out of memory),
1187 and we have a fair amount free once again,
1188 try to set aside another reserve in case we run out once more.
1189
1190 This is called when a relocatable block is freed in ralloc.c. */
1191
1192void
1193refill_memory_reserve ()
1194{
1195 if (spare_memory == 0)
1196 spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
1197}
1198
1199
1200/* This function is the malloc hook that Emacs uses. */ 1209/* This function is the malloc hook that Emacs uses. */
1201 1210
1202static void * 1211static void *
@@ -1348,6 +1357,7 @@ uninterrupt_malloc ()
1348 __realloc_hook = emacs_blocked_realloc; 1357 __realloc_hook = emacs_blocked_realloc;
1349} 1358}
1350 1359
1360#endif /* not SYNC_INPUT */
1351#endif /* not SYSTEM_MALLOC */ 1361#endif /* not SYSTEM_MALLOC */
1352 1362
1353 1363
@@ -4684,7 +4694,7 @@ returns nil, because real GC can't be done. */)
4684 turned off in that buffer. Calling truncate_undo_list on 4694 turned off in that buffer. Calling truncate_undo_list on
4685 Qt tends to return NULL, which effectively turns undo back on. 4695 Qt tends to return NULL, which effectively turns undo back on.
4686 So don't call truncate_undo_list if undo_list is Qt. */ 4696 So don't call truncate_undo_list if undo_list is Qt. */
4687 if (! EQ (nextb->undo_list, Qt)) 4697 if (! NILP (nextb->name) && ! EQ (nextb->undo_list, Qt))
4688 truncate_undo_list (nextb); 4698 truncate_undo_list (nextb);
4689 4699
4690 /* Shrink buffer gaps, but skip indirect and dead buffers. */ 4700 /* Shrink buffer gaps, but skip indirect and dead buffers. */
@@ -4797,6 +4807,10 @@ returns nil, because real GC can't be done. */)
4797 } 4807 }
4798 mark_backtrace (); 4808 mark_backtrace ();
4799 4809
4810#ifdef HAVE_WINDOW_SYSTEM
4811 mark_fringe_data ();
4812#endif
4813
4800#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES 4814#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
4801 mark_stack (); 4815 mark_stack ();
4802#endif 4816#endif