Commit d054e34e authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Delegate includes of jemalloc to the portability header

Summary: [Folly] Delegate `#include <jemalloc/jemalloc.h>` to the portability header.

Reviewed By: interwq

Differential Revision: D19254447

fbshipit-source-id: f07ac46e65313cbe5b9b7ba3df139978fad83b33
parent bf2ab1e0
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
#include <folly/experimental/JemallocHugePageAllocator.h> #include <folly/experimental/JemallocHugePageAllocator.h>
#include <folly/portability/Malloc.h>
#include <folly/portability/String.h> #include <folly/portability/String.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <sstream> #include <sstream>
#if defined(MADV_HUGEPAGE) && defined(FOLLY_USE_JEMALLOC) && !FOLLY_SANITIZE #if defined(MADV_HUGEPAGE) && defined(FOLLY_USE_JEMALLOC) && !FOLLY_SANITIZE
#include <jemalloc/jemalloc.h>
#if (JEMALLOC_VERSION_MAJOR >= 5) #if (JEMALLOC_VERSION_MAJOR >= 5)
#define FOLLY_JEMALLOC_HUGE_PAGE_ALLOCATOR_SUPPORTED 1 #define FOLLY_JEMALLOC_HUGE_PAGE_ALLOCATOR_SUPPORTED 1
bool folly::JemallocHugePageAllocator::hugePagesSupported{true}; bool folly::JemallocHugePageAllocator::hugePagesSupported{true};
......
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
#include <folly/CPortability.h> #include <folly/CPortability.h>
#include <folly/portability/Config.h> #include <folly/portability/Config.h>
#include <folly/portability/Malloc.h>
#if defined(FOLLY_USE_JEMALLOC) && !FOLLY_SANITIZE #if defined(FOLLY_USE_JEMALLOC) && !FOLLY_SANITIZE
#include <folly/portability/SysMman.h> #include <folly/portability/SysMman.h>
#include <jemalloc/jemalloc.h>
#if (JEMALLOC_VERSION_MAJOR > 3) && defined(MADV_DONTDUMP) #if (JEMALLOC_VERSION_MAJOR > 3) && defined(MADV_DONTDUMP)
#define FOLLY_JEMALLOC_NODUMP_ALLOCATOR_SUPPORTED 1 #define FOLLY_JEMALLOC_NODUMP_ALLOCATOR_SUPPORTED 1
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <folly/CPortability.h> #include <folly/CPortability.h>
#include <folly/portability/Config.h> #include <folly/portability/Config.h>
#include <folly/portability/Malloc.h>
/** /**
* Define various MALLOCX_* macros normally provided by jemalloc. We define * Define various MALLOCX_* macros normally provided by jemalloc. We define
...@@ -29,7 +30,6 @@ ...@@ -29,7 +30,6 @@
*/ */
#if (defined(USE_JEMALLOC) || defined(FOLLY_USE_JEMALLOC)) && !FOLLY_SANITIZE #if (defined(USE_JEMALLOC) || defined(FOLLY_USE_JEMALLOC)) && !FOLLY_SANITIZE
// We have JEMalloc, so use it. // We have JEMalloc, so use it.
#include <jemalloc/jemalloc.h> // @manual
#else #else
#ifndef MALLOCX_LG_ALIGN #ifndef MALLOCX_LG_ALIGN
#define MALLOCX_LG_ALIGN(la) (la) #define MALLOCX_LG_ALIGN(la) (la)
...@@ -42,16 +42,6 @@ ...@@ -42,16 +42,6 @@
#include <folly/lang/Exception.h> /* nolint */ #include <folly/lang/Exception.h> /* nolint */
#include <folly/memory/detail/MallocImpl.h> /* nolint */ #include <folly/memory/detail/MallocImpl.h> /* nolint */
// for malloc_usable_size
// NOTE: FreeBSD 9 doesn't have malloc.h. Its definitions
// are found in stdlib.h.
// However FreeBSD 11 and so does have it.
#if !defined(__FreeBSD__)
#if __has_include(<malloc.h>)
#include <malloc.h>
#endif
#endif
#include <cassert> #include <cassert>
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
......
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