Skip to content

Commit

Permalink
ARROW-6977: [C++] Disable jemalloc background_thread on macOS
Browse files Browse the repository at this point in the history
The option isn't always available, perhaps based on the macOS version
or configured SDK version.

Closes #5729 from pitrou/ARROW-6977-macos-jemalloc-background-thread and squashes the following commits:

42ff1a9 <Antoine Pitrou> ARROW-6977:  Disable jemalloc background_thread on macOS

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Neal Richardson <neal.p.richardson@gmail.com>
  • Loading branch information
pitrou authored and kszucs committed Oct 24, 2019
1 parent c20eceb commit 4142ed5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/windows-msvc-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
steps:
- uses: actions/checkout@master
- name: CMake
shell: cmd
run: |
mkdir build\cpp
cmake ^
Expand All @@ -48,5 +49,6 @@ jobs:
-S cpp ^
-B build\cpp
- name: Install
shell: cmd
run: |
cmake --build build\cpp --config Debug --target Install
31 changes: 19 additions & 12 deletions cpp/src/arrow/memory_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,29 @@
// aggressively (and in the background) to the OS. This can be configured
// further by using the arrow::jemalloc_set_decay_ms API

#undef USE_JEMALLOC_BACKGROUND_THREAD
#ifndef __APPLE__
// ARROW-6977: jemalloc's background_thread isn't always enabled on macOS
#define USE_JEMALLOC_BACKGROUND_THREAD
#endif

// In debug mode, add memory poisoning on alloc / free
#ifdef NDEBUG
const char* je_arrow_malloc_conf =
("oversize_threshold:0,"
"dirty_decay_ms:1000,"
"muzzy_decay_ms:1000,"
"background_thread:true");
#define JEMALLOC_DEBUG_OPTIONS ""
#else
// In debug mode, add memory poisoning on alloc / free
const char* je_arrow_malloc_conf =
("oversize_threshold:0,"
"junk:true,"
"dirty_decay_ms:1000,"
"muzzy_decay_ms:1000,"
"background_thread:true");
#define JEMALLOC_DEBUG_OPTIONS ",junk:true"
#endif

const char* je_arrow_malloc_conf =
("oversize_threshold:0"
",dirty_decay_ms:1000"
",muzzy_decay_ms:1000"
#ifdef USE_JEMALLOC_BACKGROUND_THREAD
",background_thread:true"
#endif
JEMALLOC_DEBUG_OPTIONS); // NOLINT: whitespace/parens

#endif // ARROW_JEMALLOC

namespace arrow {

Expand Down

0 comments on commit 4142ed5

Please sign in to comment.