Commit bfee710a authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

[t:3825] #3825 Fix accounting for toku_xrealloc().

git-svn-id: file:///svn/toku/tokudb@33970 c7de825b-a66e-492c-adef-691d508d4ae1
parent 55b32361
...@@ -115,11 +115,11 @@ toku_xcalloc(size_t nmemb, size_t size) { ...@@ -115,11 +115,11 @@ toku_xcalloc(size_t nmemb, size_t size) {
void * void *
toku_xrealloc(void *v, size_t size) { toku_xrealloc(void *v, size_t size) {
size_t used_orig = malloc_usable_size(v); size_t used_orig = v ? malloc_usable_size(v) : 0;
void *p = t_xrealloc ? t_xrealloc(v, size) : os_realloc(v, size); void *p = t_xrealloc ? t_xrealloc(v, size) : os_realloc(v, size);
size_t used = malloc_usable_size(p);
if (p == 0) // avoid function call in common case if (p == 0) // avoid function call in common case
resource_assert(p); resource_assert(p);
size_t used = malloc_usable_size(p);
__sync_add_and_fetch(&status.realloc_count, 1L); __sync_add_and_fetch(&status.realloc_count, 1L);
__sync_add_and_fetch(&status.requested, size); __sync_add_and_fetch(&status.requested, size);
__sync_add_and_fetch(&status.used, used); __sync_add_and_fetch(&status.used, used);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment