aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c58
1 files changed, 23 insertions, 35 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 3306bc4107b..0d4491e8472 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2958,17 +2958,7 @@ static struct Lisp_Vector *zero_vector;
2958static struct vector_block * 2958static struct vector_block *
2959allocate_vector_block (void) 2959allocate_vector_block (void)
2960{ 2960{
2961 struct vector_block *block; 2961 struct vector_block *block = xmalloc (sizeof (struct vector_block));
2962
2963#ifdef DOUG_LEA_MALLOC
2964 mallopt (M_MMAP_MAX, 0);
2965#endif
2966
2967 block = xmalloc (sizeof (struct vector_block));
2968
2969#ifdef DOUG_LEA_MALLOC
2970 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
2971#endif
2972 2962
2973#if GC_MARK_STACK && !defined GC_MALLOC_CHECK 2963#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
2974 mem_insert (block->data, block->data + VECTOR_BLOCK_BYTES, 2964 mem_insert (block->data, block->data + VECTOR_BLOCK_BYTES,
@@ -3166,44 +3156,42 @@ static struct Lisp_Vector *
3166allocate_vectorlike (ptrdiff_t len) 3156allocate_vectorlike (ptrdiff_t len)
3167{ 3157{
3168 struct Lisp_Vector *p; 3158 struct Lisp_Vector *p;
3169 size_t nbytes;
3170 3159
3171 MALLOC_BLOCK_INPUT; 3160 MALLOC_BLOCK_INPUT;
3172 3161
3173#ifdef DOUG_LEA_MALLOC
3174 /* Prevent mmap'ing the chunk. Lisp data may not be mmap'ed
3175 because mapped region contents are not preserved in
3176 a dumped Emacs. */
3177 mallopt (M_MMAP_MAX, 0);
3178#endif
3179
3180 /* This gets triggered by code which I haven't bothered to fix. --Stef */ 3162 /* This gets triggered by code which I haven't bothered to fix. --Stef */
3181 /* eassert (!handling_signal); */ 3163 /* eassert (!handling_signal); */
3182 3164
3183 if (len == 0) 3165 if (len == 0)
3166 p = zero_vector;
3167 else
3184 { 3168 {
3185 MALLOC_UNBLOCK_INPUT; 3169 size_t nbytes = header_size + len * word_size;
3186 return zero_vector;
3187 }
3188 3170
3189 nbytes = header_size + len * word_size; 3171#ifdef DOUG_LEA_MALLOC
3172 /* Prevent mmap'ing the chunk. Lisp data may not be mmap'ed
3173 because mapped region contents are not preserved in
3174 a dumped Emacs. */
3175 mallopt (M_MMAP_MAX, 0);
3176#endif
3190 3177
3191 if (nbytes <= VBLOCK_BYTES_MAX) 3178 if (nbytes <= VBLOCK_BYTES_MAX)
3192 p = allocate_vector_from_block (vroundup (nbytes)); 3179 p = allocate_vector_from_block (vroundup (nbytes));
3193 else 3180 else
3194 { 3181 {
3195 p = (struct Lisp_Vector *) lisp_malloc (nbytes, MEM_TYPE_VECTORLIKE); 3182 p = (struct Lisp_Vector *) lisp_malloc (nbytes, MEM_TYPE_VECTORLIKE);
3196 p->header.next.vector = large_vectors; 3183 p->header.next.vector = large_vectors;
3197 large_vectors = p; 3184 large_vectors = p;
3198 } 3185 }
3199 3186
3200#ifdef DOUG_LEA_MALLOC 3187#ifdef DOUG_LEA_MALLOC
3201 /* Back to a reasonable maximum of mmap'ed areas. */ 3188 /* Back to a reasonable maximum of mmap'ed areas. */
3202 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); 3189 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
3203#endif 3190#endif
3204 3191
3205 consing_since_gc += nbytes; 3192 consing_since_gc += nbytes;
3206 vector_cells_consed += len; 3193 vector_cells_consed += len;
3194 }
3207 3195
3208 MALLOC_UNBLOCK_INPUT; 3196 MALLOC_UNBLOCK_INPUT;
3209 3197