mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-05 19:54:16 +03:00
Add stats counters for number of zero reallocs
This commit is contained in:
parent
9cfa805947
commit
de81a4eada
8 changed files with 81 additions and 2 deletions
|
|
@ -70,6 +70,8 @@ bool opt_junk_free =
|
|||
zero_realloc_action_t opt_zero_realloc_action =
|
||||
zero_realloc_action_strict;
|
||||
|
||||
atomic_zu_t zero_realloc_count = ATOMIC_INIT(0);
|
||||
|
||||
const char *zero_realloc_mode_names[] = {
|
||||
"strict",
|
||||
"free",
|
||||
|
|
@ -3160,6 +3162,9 @@ je_rallocx(void *ptr, size_t size, int flags) {
|
|||
|
||||
static void *
|
||||
do_realloc_nonnull_zero(void *ptr) {
|
||||
if (config_stats) {
|
||||
atomic_fetch_add_zu(&zero_realloc_count, 1, ATOMIC_RELAXED);
|
||||
}
|
||||
if (opt_zero_realloc_action == zero_realloc_action_strict) {
|
||||
/*
|
||||
* The user might have gotten a strict setting while expecting a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue