summaryrefslogtreecommitdiff
path: root/src/zmalloc.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-07-12 12:39:16 +0200
committerantirez <antirez@gmail.com>2011-07-12 12:39:16 +0200
commit0681c5ad844cefefbe62f30df6587c0cbec3272e (patch)
tree35ab1b7e8863dba2b728d2bae871042309206413 /src/zmalloc.c
parent15bc1cc1bcd4174e7116b5429f1f31f792d13d2e (diff)
parent34a8b51768a2579010e128b05e001bf1d8f99995 (diff)
downloadredis-0681c5ad844cefefbe62f30df6587c0cbec3272e.tar.gz
master branch merged into scripting.
Diffstat (limited to 'src/zmalloc.c')
-rw-r--r--src/zmalloc.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/src/zmalloc.c b/src/zmalloc.c
index 428951a46..5408c2faf 100644
--- a/src/zmalloc.c
+++ b/src/zmalloc.c
@@ -60,16 +60,13 @@
#define update_zmalloc_stat_alloc(__n,__size) do { \
size_t _n = (__n); \
- size_t _stat_slot = (__size < ZMALLOC_MAX_ALLOC_STAT) ? __size : ZMALLOC_MAX_ALLOC_STAT; \
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \
if (zmalloc_thread_safe) { \
pthread_mutex_lock(&used_memory_mutex); \
used_memory += _n; \
- zmalloc_allocations[_stat_slot]++; \
pthread_mutex_unlock(&used_memory_mutex); \
} else { \
used_memory += _n; \
- zmalloc_allocations[_stat_slot]++; \
} \
} while(0)
@@ -88,8 +85,6 @@
static size_t used_memory = 0;
static int zmalloc_thread_safe = 0;
pthread_mutex_t used_memory_mutex = PTHREAD_MUTEX_INITIALIZER;
-/* Note that malloc_allocations elements are initialized to zero by C */
-size_t zmalloc_allocations[ZMALLOC_MAX_ALLOC_STAT+1];
static void zmalloc_oom(size_t size) {
fprintf(stderr, "zmalloc: Out of memory trying to allocate %zu bytes\n",
@@ -190,11 +185,6 @@ size_t zmalloc_used_memory(void) {
return um;
}
-size_t zmalloc_allocations_for_size(size_t size) {
- if (size > ZMALLOC_MAX_ALLOC_STAT) return 0;
- return zmalloc_allocations[size];
-}
-
void zmalloc_enable_thread_safeness(void) {
zmalloc_thread_safe = 1;
}