Commit 8d4965ca authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 3

Don't try to use the malloc_usable_size portability implementation if we have JEMalloc

Summary:
This is only an issue for the OSS HHVM build on OSX, where we have JEMalloc headers included directly.
In the OSS HHVM build, we define `USE_JEMALLOC` globally if we have JEMalloc, so gate the portability implementation behind that.

Reviewed By: mzlee

Differential Revision: D3237449

fb-gh-sync-id: 07cf9b31114723ffd9f2b29cf449bee0ed8f5703
fbshipit-source-id: 07cf9b31114723ffd9f2b29cf449bee0ed8f5703
parent a0a4a68d
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <folly/portability/Malloc.h> #include <folly/portability/Malloc.h>
#ifndef USE_JEMALLOC
#if defined(__APPLE__) && !defined(FOLLY_HAVE_MALLOC_USABLE_SIZE) #if defined(__APPLE__) && !defined(FOLLY_HAVE_MALLOC_USABLE_SIZE)
#include <malloc/malloc.h> #include <malloc/malloc.h>
...@@ -27,3 +28,4 @@ extern "C" size_t malloc_usable_size(void* addr) { ...@@ -27,3 +28,4 @@ extern "C" size_t malloc_usable_size(void* addr) {
return _msize(addr); return _msize(addr);
} }
#endif #endif
#endif
...@@ -18,6 +18,11 @@ ...@@ -18,6 +18,11 @@
#include <stdlib.h> #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__ #ifndef __APPLE__
#include <malloc.h> #include <malloc.h>
#endif #endif
...@@ -30,3 +35,4 @@ extern "C" size_t malloc_usable_size(void* ptr); ...@@ -30,3 +35,4 @@ extern "C" size_t malloc_usable_size(void* ptr);
#elif defined(_WIN32) #elif defined(_WIN32)
extern "C" size_t malloc_usable_size(void* ptr); extern "C" size_t malloc_usable_size(void* ptr);
#endif #endif
#endif
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