mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-06 02:16:14 +03:00
Realloc: Make behavior of realloc(ptr, 0) configurable.
This commit is contained in:
parent
ee961c2310
commit
9cfa805947
15 changed files with 256 additions and 26 deletions
|
|
@ -18,6 +18,8 @@ extern bool opt_utrace;
|
|||
extern bool opt_xmalloc;
|
||||
extern bool opt_zero;
|
||||
extern unsigned opt_narenas;
|
||||
extern zero_realloc_action_t opt_zero_realloc_action;
|
||||
extern const char *zero_realloc_mode_names[];
|
||||
|
||||
/* Number of CPUs. */
|
||||
extern unsigned ncpus;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,17 @@ typedef unsigned szind_t;
|
|||
/* Processor / core id type. */
|
||||
typedef int malloc_cpuid_t;
|
||||
|
||||
/* When realloc(non-null-ptr, 0) is called, what happens? */
|
||||
enum zero_realloc_action_e {
|
||||
/* Realloc(ptr, 0) is free(ptr); return malloc(0); */
|
||||
zero_realloc_action_strict = 0,
|
||||
/* Realloc(ptr, 0) is free(ptr); */
|
||||
zero_realloc_action_free = 1,
|
||||
/* Realloc(ptr, 0) aborts. */
|
||||
zero_realloc_action_abort = 2
|
||||
};
|
||||
typedef enum zero_realloc_action_e zero_realloc_action_t;
|
||||
|
||||
/*
|
||||
* Flags bits:
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue