#include <folly/portability/Malloc.h>
+#ifndef USE_JEMALLOC
#if defined(__APPLE__) && !defined(FOLLY_HAVE_MALLOC_USABLE_SIZE)
#include <malloc/malloc.h>
return _msize(addr);
}
#endif
+#endif
#include <stdlib.h>
+#ifdef USE_JEMALLOC
+// JEMalloc provides it's own implementation of
+// malloc_usable_size, and that's what we should be using.
+#include <jemalloc/jemalloc.h>
+#else
#ifndef __APPLE__
#include <malloc.h>
#endif
#elif defined(_WIN32)
extern "C" size_t malloc_usable_size(void* ptr);
#endif
+#endif