comparison src/alloc.c @ 23973:2eb9e2f5aa33

(MMAP_MAX_AREAS): New macro. (allocate_vectorlike, make_uninit_multibyte_string): Use that. (init_alloc_once): Use that.
author Richard M. Stallman <rms@gnu.org>
date Sat, 02 Jan 1999 00:10:26 +0000
parents 7094b74ce0a6
children 3bb745067f0e
comparison
equal deleted inserted replaced
23972:98ac51fd1935 23973:2eb9e2f5aa33
40 extern char *sbrk (); 40 extern char *sbrk ();
41 41
42 #ifdef DOUG_LEA_MALLOC 42 #ifdef DOUG_LEA_MALLOC
43 #include <malloc.h> 43 #include <malloc.h>
44 #define __malloc_size_t int 44 #define __malloc_size_t int
45
46 /* Specify maximum number of areas to mmap.
47 It would be nice to use a value that explicitly
48 means "no limit". */
49 #define MMAP_MAX_AREAS 100000000
50
45 #else 51 #else
46 /* The following come from gmalloc.c. */ 52 /* The following come from gmalloc.c. */
47 53
48 #if defined (__STDC__) && __STDC__ 54 #if defined (__STDC__) && __STDC__
49 #include <stddef.h> 55 #include <stddef.h>
838 #endif 844 #endif
839 p = (struct Lisp_Vector *)lisp_malloc (sizeof (struct Lisp_Vector) 845 p = (struct Lisp_Vector *)lisp_malloc (sizeof (struct Lisp_Vector)
840 + (len - 1) * sizeof (Lisp_Object)); 846 + (len - 1) * sizeof (Lisp_Object));
841 #ifdef DOUG_LEA_MALLOC 847 #ifdef DOUG_LEA_MALLOC
842 /* Back to a reasonable maximum of mmap'ed areas. */ 848 /* Back to a reasonable maximum of mmap'ed areas. */
843 mallopt (M_MMAP_MAX, 64); 849 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
844 #endif 850 #endif
845 VALIDATE_LISP_STORAGE (p, 0); 851 VALIDATE_LISP_STORAGE (p, 0);
846 consing_since_gc += (sizeof (struct Lisp_Vector) 852 consing_since_gc += (sizeof (struct Lisp_Vector)
847 + (len - 1) * sizeof (Lisp_Object)); 853 + (len - 1) * sizeof (Lisp_Object));
848 vector_cells_consed += len; 854 vector_cells_consed += len;
1425 mallopt (M_MMAP_MAX, 0); 1431 mallopt (M_MMAP_MAX, 0);
1426 #endif 1432 #endif
1427 new = (struct string_block *) lisp_malloc (sizeof (struct string_block_head) + fullsize); 1433 new = (struct string_block *) lisp_malloc (sizeof (struct string_block_head) + fullsize);
1428 #ifdef DOUG_LEA_MALLOC 1434 #ifdef DOUG_LEA_MALLOC
1429 /* Back to a reasonable maximum of mmap'ed areas. */ 1435 /* Back to a reasonable maximum of mmap'ed areas. */
1430 mallopt (M_MMAP_MAX, 64); 1436 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
1431 #endif 1437 #endif
1432 n_string_blocks++; 1438 n_string_blocks++;
1433 VALIDATE_LISP_STORAGE (new, 0); 1439 VALIDATE_LISP_STORAGE (new, 0);
1434 consing_since_gc += sizeof (struct string_block_head) + fullsize; 1440 consing_since_gc += sizeof (struct string_block_head) + fullsize;
1435 new->pos = fullsize; 1441 new->pos = fullsize;
3012 all_vectors = 0; 3018 all_vectors = 0;
3013 ignore_warnings = 1; 3019 ignore_warnings = 1;
3014 #ifdef DOUG_LEA_MALLOC 3020 #ifdef DOUG_LEA_MALLOC
3015 mallopt (M_TRIM_THRESHOLD, 128*1024); /* trim threshold */ 3021 mallopt (M_TRIM_THRESHOLD, 128*1024); /* trim threshold */
3016 mallopt (M_MMAP_THRESHOLD, 64*1024); /* mmap threshold */ 3022 mallopt (M_MMAP_THRESHOLD, 64*1024); /* mmap threshold */
3017 mallopt (M_MMAP_MAX, 64); /* max. number of mmap'ed areas */ 3023 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); /* max. number of mmap'ed areas */
3018 #endif 3024 #endif
3019 init_strings (); 3025 init_strings ();
3020 init_cons (); 3026 init_cons ();
3021 init_symbol (); 3027 init_symbol ();
3022 init_marker (); 3028 init_marker ();