diff options
author | Yash Tibrewal <yashkt@google.com> | 2017-11-06 14:39:17 -0800 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2017-11-06 14:43:31 -0800 |
commit | 40422d5fa621624868280094efb2f01c2cd1352b (patch) | |
tree | cbb2baa955e11c03fa004e9e0f4f3037ba3d6150 /test/core/util/memory_counters.cc | |
parent | aae4ca01a315a69fcf182d09aea1efdfcda13d48 (diff) | |
parent | e759d2ad7abdb0702970eeccc5f033ff4b2a4c7f (diff) |
Merge master
Diffstat (limited to 'test/core/util/memory_counters.cc')
-rw-r--r-- | test/core/util/memory_counters.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/test/core/util/memory_counters.cc b/test/core/util/memory_counters.cc index 9fb3ffe095..ff85a63803 100644 --- a/test/core/util/memory_counters.cc +++ b/test/core/util/memory_counters.cc @@ -27,9 +27,9 @@ static struct grpc_memory_counters g_memory_counters; static gpr_allocation_functions g_old_allocs; -static void *guard_malloc(size_t size); -static void *guard_realloc(void *vptr, size_t size); -static void guard_free(void *vptr); +static void* guard_malloc(size_t size); +static void* guard_realloc(void* vptr, size_t size); +static void guard_free(void* vptr); #ifdef GPR_LOW_LEVEL_COUNTERS /* hide these from the microbenchmark atomic stats */ @@ -41,20 +41,20 @@ static void guard_free(void *vptr); #define NO_BARRIER_LOAD(x) gpr_atm_no_barrier_load(x) #endif -static void *guard_malloc(size_t size) { - size_t *ptr; +static void* guard_malloc(size_t size) { + size_t* ptr; if (!size) return NULL; NO_BARRIER_FETCH_ADD(&g_memory_counters.total_size_absolute, (gpr_atm)size); NO_BARRIER_FETCH_ADD(&g_memory_counters.total_size_relative, (gpr_atm)size); NO_BARRIER_FETCH_ADD(&g_memory_counters.total_allocs_absolute, (gpr_atm)1); NO_BARRIER_FETCH_ADD(&g_memory_counters.total_allocs_relative, (gpr_atm)1); - ptr = (size_t *)g_old_allocs.malloc_fn(size + sizeof(size)); + ptr = (size_t*)g_old_allocs.malloc_fn(size + sizeof(size)); *ptr++ = size; return ptr; } -static void *guard_realloc(void *vptr, size_t size) { - size_t *ptr = (size_t *)vptr; +static void* guard_realloc(void* vptr, size_t size) { + size_t* ptr = (size_t*)vptr; if (vptr == NULL) { return guard_malloc(size); } @@ -67,13 +67,13 @@ static void *guard_realloc(void *vptr, size_t size) { NO_BARRIER_FETCH_ADD(&g_memory_counters.total_size_relative, -(gpr_atm)*ptr); NO_BARRIER_FETCH_ADD(&g_memory_counters.total_size_relative, (gpr_atm)size); NO_BARRIER_FETCH_ADD(&g_memory_counters.total_allocs_absolute, (gpr_atm)1); - ptr = (size_t *)g_old_allocs.realloc_fn(ptr, size + sizeof(size)); + ptr = (size_t*)g_old_allocs.realloc_fn(ptr, size + sizeof(size)); *ptr++ = size; return ptr; } -static void guard_free(void *vptr) { - size_t *ptr = (size_t *)vptr; +static void guard_free(void* vptr) { + size_t* ptr = (size_t*)vptr; if (!vptr) return; --ptr; NO_BARRIER_FETCH_ADD(&g_memory_counters.total_size_relative, -(gpr_atm)*ptr); |