mirror of
https://github.com/fluencelabs/redis
synced 2025-06-18 03:31:21 +00:00
Don't use prefix when malloc_size() can be called
Also, use tcmalloc functions explicitly via macros to prevent symbol lookups to resolve to native malloc/free on OSX.
This commit is contained in:
@ -32,13 +32,24 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined(__sun)
|
||||
#define PREFIX_SIZE sizeof(long long)
|
||||
#ifdef HAVE_MALLOC_SIZE
|
||||
#define PREFIX_SIZE (0)
|
||||
#else
|
||||
#define PREFIX_SIZE sizeof(size_t)
|
||||
#if defined(__sun)
|
||||
#define PREFIX_SIZE (sizeof(long long))
|
||||
#else
|
||||
#define PREFIX_SIZE (sizeof(size_t))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Explicitly override malloc/free etc when using tcmalloc. */
|
||||
#if defined(USE_TCMALLOC)
|
||||
#define malloc(size) tc_malloc(size)
|
||||
#define calloc(count,size) tc_calloc(count,size)
|
||||
#define realloc(ptr,size) tc_realloc(ptr,size)
|
||||
#define free(ptr) tc_free(ptr)
|
||||
#endif
|
||||
|
||||
#define increment_used_memory(__n) do { \
|
||||
|
Reference in New Issue
Block a user