mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
* malloc/malloc.c (DEFAULT_MMAP_THRESHOLD_MAX): For 32-bit
platforms define as 1MB. For 64-bit platforms as 32MB. The lower limit is needed to avoid the exploding of the address space requirement for secondary heaps. * malloc/arena.c (HEAP_MAX_SIZE): Define using DEFAULT_MMAP_THRESHOLD_MAX if it is defined.
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
2006-08-21 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* malloc/malloc.c (DEFAULT_MMAP_THRESHOLD_MAX): For 32-bit
|
||||||
|
platforms define as 1MB. For 64-bit platforms as 32MB. The lower
|
||||||
|
limit is needed to avoid the exploding of the address space
|
||||||
|
requirement for secondary heaps.
|
||||||
|
* malloc/arena.c (HEAP_MAX_SIZE): Define using
|
||||||
|
DEFAULT_MMAP_THRESHOLD_MAX if it is defined.
|
||||||
|
|
||||||
2006-07-30 Joseph S. Myers <joseph@codesourcery.com>
|
2006-07-30 Joseph S. Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
[BZ #3018]
|
[BZ #3018]
|
||||||
|
@ -24,7 +24,11 @@
|
|||||||
|
|
||||||
#define HEAP_MIN_SIZE (32*1024)
|
#define HEAP_MIN_SIZE (32*1024)
|
||||||
#ifndef HEAP_MAX_SIZE
|
#ifndef HEAP_MAX_SIZE
|
||||||
#define HEAP_MAX_SIZE (1024*1024) /* must be a power of two */
|
# ifdef DEFAULT_MMAP_THRESHOLD_MAX
|
||||||
|
# define HEAP_MAX_SIZE DEFAULT_MMAP_THRESHOLD_MAX
|
||||||
|
# else
|
||||||
|
# define HEAP_MAX_SIZE (1024*1024) /* must be a power of two */
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* HEAP_MIN_SIZE and HEAP_MAX_SIZE limit the size of mmap()ed heaps
|
/* HEAP_MIN_SIZE and HEAP_MAX_SIZE limit the size of mmap()ed heaps
|
||||||
|
@ -259,6 +259,7 @@
|
|||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
#include <stdio-common/_itoa.h>
|
#include <stdio-common/_itoa.h>
|
||||||
|
#include <bits/wordsize.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -1424,7 +1425,15 @@ int __posix_memalign(void **, size_t, size_t);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DEFAULT_MMAP_THRESHOLD_MAX
|
#ifndef DEFAULT_MMAP_THRESHOLD_MAX
|
||||||
#define DEFAULT_MMAP_THRESHOLD_MAX (8 * 1024 * 1024 * sizeof(long))
|
/* For 32-bit platforms we cannot increase the maximum mmap
|
||||||
|
threshold much because it is also the minimum value for the
|
||||||
|
maximum heap size and its alignment. Going above 1MB wastes too
|
||||||
|
much address space. */
|
||||||
|
# if __WORDSIZE == 32
|
||||||
|
# define DEFAULT_MMAP_THRESHOLD_MAX (1024 * 1024)
|
||||||
|
# else
|
||||||
|
# define DEFAULT_MMAP_THRESHOLD_MAX (8 * 1024 * 1024 * sizeof(long))
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2867,6 +2876,7 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
|
|||||||
|
|
||||||
char* mm; /* return value from mmap call*/
|
char* mm; /* return value from mmap call*/
|
||||||
|
|
||||||
|
try_mmap:
|
||||||
/*
|
/*
|
||||||
Round up size to nearest page. For mmapped chunks, the overhead
|
Round up size to nearest page. For mmapped chunks, the overhead
|
||||||
is one SIZE_SZ unit larger than for normal chunks, because there
|
is one SIZE_SZ unit larger than for normal chunks, because there
|
||||||
@ -2996,6 +3006,9 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
|
|||||||
set_foot(old_top, (old_size + 2*SIZE_SZ));
|
set_foot(old_top, (old_size + 2*SIZE_SZ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
/* We can at least try to use to mmap memory. */
|
||||||
|
goto try_mmap;
|
||||||
|
|
||||||
} else { /* av == main_arena */
|
} else { /* av == main_arena */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user