diff options
author | Bruce Merry <bmerry@gmail.com> | 2018-09-30 11:49:03 +0200 |
---|---|---|
committer | Bruce Merry <bmerry@gmail.com> | 2018-09-30 11:49:03 +0200 |
commit | 8fd1031b10dec256d5b365b278815f9d8444e601 (patch) | |
tree | ac8ec935162efe46728f6acf3df5166614453493 /src/zmalloc.h | |
parent | 1d6711a7645cd11bea2e55a438e7a25891117cd6 (diff) | |
download | redis-8fd1031b10dec256d5b365b278815f9d8444e601.tar.gz |
Fix incorrect memory usage accounting in zrealloc
When HAVE_MALLOC_SIZE is false, each call to zrealloc causes used_memory
to increase by PREFIX_SIZE more than it should, due to mis-matched
accounting between the original zmalloc (which includes PREFIX size in
its increment) and zrealloc (which misses it from its decrement).
I've also supplied a command-line test to easily demonstrate the
problem. It's not wired into the test framework, because I don't know
TCL so I'm not sure how to automate it.
Diffstat (limited to 'src/zmalloc.h')
-rw-r--r-- | src/zmalloc.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/zmalloc.h b/src/zmalloc.h index 9c9229907..6fb19b046 100644 --- a/src/zmalloc.h +++ b/src/zmalloc.h @@ -103,4 +103,8 @@ size_t zmalloc_usable(void *ptr); #define zmalloc_usable(p) zmalloc_size(p) #endif +#ifdef REDIS_TEST +int zmalloc_test(int argc, char **argv); +#endif + #endif /* __ZMALLOC_H */ |