drop bump_empty_alloc option. Size class lookup support used instead.
This commit is contained in:
parent
4edbb7c64c
commit
ac34afb403
@ -134,7 +134,6 @@ JEMALLOC_ALWAYS_INLINE void *
|
|||||||
arena_malloc(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind, bool zero,
|
arena_malloc(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind, bool zero,
|
||||||
tcache_t *tcache, bool slow_path) {
|
tcache_t *tcache, bool slow_path) {
|
||||||
assert(!tsdn_null(tsdn) || tcache == NULL);
|
assert(!tsdn_null(tsdn) || tcache == NULL);
|
||||||
assert(size != 0);
|
|
||||||
|
|
||||||
if (likely(tcache != NULL)) {
|
if (likely(tcache != NULL)) {
|
||||||
if (likely(size <= SC_SMALL_MAXCLASS)) {
|
if (likely(size <= SC_SMALL_MAXCLASS)) {
|
||||||
|
@ -43,7 +43,6 @@ iallocztm(tsdn_t *tsdn, size_t size, szind_t ind, bool zero, tcache_t *tcache,
|
|||||||
bool is_internal, arena_t *arena, bool slow_path) {
|
bool is_internal, arena_t *arena, bool slow_path) {
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
assert(size != 0);
|
|
||||||
assert(!is_internal || tcache == NULL);
|
assert(!is_internal || tcache == NULL);
|
||||||
assert(!is_internal || arena == NULL || arena_is_auto(arena));
|
assert(!is_internal || arena == NULL || arena_is_auto(arena));
|
||||||
if (!tsdn_null(tsdn) && tsd_reentrancy_level_get(tsdn_tsd(tsdn)) == 0) {
|
if (!tsdn_null(tsdn) && tsd_reentrancy_level_get(tsdn_tsd(tsdn)) == 0) {
|
||||||
|
@ -1713,8 +1713,7 @@ typedef struct static_opts_s static_opts_t;
|
|||||||
struct static_opts_s {
|
struct static_opts_s {
|
||||||
/* Whether or not allocation size may overflow. */
|
/* Whether or not allocation size may overflow. */
|
||||||
bool may_overflow;
|
bool may_overflow;
|
||||||
/* Whether or not allocations of size 0 should be treated as size 1. */
|
|
||||||
bool bump_empty_alloc;
|
|
||||||
/*
|
/*
|
||||||
* Whether to assert that allocations are not of size 0 (after any
|
* Whether to assert that allocations are not of size 0 (after any
|
||||||
* bumping).
|
* bumping).
|
||||||
@ -1756,7 +1755,6 @@ struct static_opts_s {
|
|||||||
JEMALLOC_ALWAYS_INLINE void
|
JEMALLOC_ALWAYS_INLINE void
|
||||||
static_opts_init(static_opts_t *static_opts) {
|
static_opts_init(static_opts_t *static_opts) {
|
||||||
static_opts->may_overflow = false;
|
static_opts->may_overflow = false;
|
||||||
static_opts->bump_empty_alloc = false;
|
|
||||||
static_opts->assert_nonempty_alloc = false;
|
static_opts->assert_nonempty_alloc = false;
|
||||||
static_opts->null_out_result_on_error = false;
|
static_opts->null_out_result_on_error = false;
|
||||||
static_opts->set_errno_on_error = false;
|
static_opts->set_errno_on_error = false;
|
||||||
@ -1945,12 +1943,6 @@ imalloc_body(static_opts_t *sopts, dynamic_opts_t *dopts, tsd_t *tsd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Validate the user input. */
|
/* Validate the user input. */
|
||||||
if (sopts->bump_empty_alloc) {
|
|
||||||
if (unlikely(size == 0)) {
|
|
||||||
size = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sopts->assert_nonempty_alloc) {
|
if (sopts->assert_nonempty_alloc) {
|
||||||
assert (size != 0);
|
assert (size != 0);
|
||||||
}
|
}
|
||||||
@ -2178,7 +2170,6 @@ je_malloc(size_t size) {
|
|||||||
static_opts_init(&sopts);
|
static_opts_init(&sopts);
|
||||||
dynamic_opts_init(&dopts);
|
dynamic_opts_init(&dopts);
|
||||||
|
|
||||||
sopts.bump_empty_alloc = true;
|
|
||||||
sopts.null_out_result_on_error = true;
|
sopts.null_out_result_on_error = true;
|
||||||
sopts.set_errno_on_error = true;
|
sopts.set_errno_on_error = true;
|
||||||
sopts.oom_string = "<jemalloc>: Error in malloc(): out of memory\n";
|
sopts.oom_string = "<jemalloc>: Error in malloc(): out of memory\n";
|
||||||
@ -2215,7 +2206,6 @@ je_posix_memalign(void **memptr, size_t alignment, size_t size) {
|
|||||||
static_opts_init(&sopts);
|
static_opts_init(&sopts);
|
||||||
dynamic_opts_init(&dopts);
|
dynamic_opts_init(&dopts);
|
||||||
|
|
||||||
sopts.bump_empty_alloc = true;
|
|
||||||
sopts.min_alignment = sizeof(void *);
|
sopts.min_alignment = sizeof(void *);
|
||||||
sopts.oom_string =
|
sopts.oom_string =
|
||||||
"<jemalloc>: Error allocating aligned memory: out of memory\n";
|
"<jemalloc>: Error allocating aligned memory: out of memory\n";
|
||||||
@ -2256,7 +2246,6 @@ je_aligned_alloc(size_t alignment, size_t size) {
|
|||||||
static_opts_init(&sopts);
|
static_opts_init(&sopts);
|
||||||
dynamic_opts_init(&dopts);
|
dynamic_opts_init(&dopts);
|
||||||
|
|
||||||
sopts.bump_empty_alloc = true;
|
|
||||||
sopts.null_out_result_on_error = true;
|
sopts.null_out_result_on_error = true;
|
||||||
sopts.set_errno_on_error = true;
|
sopts.set_errno_on_error = true;
|
||||||
sopts.min_alignment = 1;
|
sopts.min_alignment = 1;
|
||||||
@ -2296,7 +2285,6 @@ je_calloc(size_t num, size_t size) {
|
|||||||
dynamic_opts_init(&dopts);
|
dynamic_opts_init(&dopts);
|
||||||
|
|
||||||
sopts.may_overflow = true;
|
sopts.may_overflow = true;
|
||||||
sopts.bump_empty_alloc = true;
|
|
||||||
sopts.null_out_result_on_error = true;
|
sopts.null_out_result_on_error = true;
|
||||||
sopts.set_errno_on_error = true;
|
sopts.set_errno_on_error = true;
|
||||||
sopts.oom_string = "<jemalloc>: Error in calloc(): out of memory\n";
|
sopts.oom_string = "<jemalloc>: Error in calloc(): out of memory\n";
|
||||||
@ -2539,7 +2527,6 @@ je_realloc(void *ptr, size_t arg_size) {
|
|||||||
static_opts_init(&sopts);
|
static_opts_init(&sopts);
|
||||||
dynamic_opts_init(&dopts);
|
dynamic_opts_init(&dopts);
|
||||||
|
|
||||||
sopts.bump_empty_alloc = true;
|
|
||||||
sopts.null_out_result_on_error = true;
|
sopts.null_out_result_on_error = true;
|
||||||
sopts.set_errno_on_error = true;
|
sopts.set_errno_on_error = true;
|
||||||
sopts.oom_string =
|
sopts.oom_string =
|
||||||
@ -2643,7 +2630,6 @@ je_memalign(size_t alignment, size_t size) {
|
|||||||
static_opts_init(&sopts);
|
static_opts_init(&sopts);
|
||||||
dynamic_opts_init(&dopts);
|
dynamic_opts_init(&dopts);
|
||||||
|
|
||||||
sopts.bump_empty_alloc = true;
|
|
||||||
sopts.min_alignment = 1;
|
sopts.min_alignment = 1;
|
||||||
sopts.oom_string =
|
sopts.oom_string =
|
||||||
"<jemalloc>: Error allocating aligned memory: out of memory\n";
|
"<jemalloc>: Error allocating aligned memory: out of memory\n";
|
||||||
@ -2683,7 +2669,6 @@ je_valloc(size_t size) {
|
|||||||
static_opts_init(&sopts);
|
static_opts_init(&sopts);
|
||||||
dynamic_opts_init(&dopts);
|
dynamic_opts_init(&dopts);
|
||||||
|
|
||||||
sopts.bump_empty_alloc = true;
|
|
||||||
sopts.null_out_result_on_error = true;
|
sopts.null_out_result_on_error = true;
|
||||||
sopts.min_alignment = PAGE;
|
sopts.min_alignment = PAGE;
|
||||||
sopts.oom_string =
|
sopts.oom_string =
|
||||||
|
Loading…
Reference in New Issue
Block a user