From: Qi Wang Date: Fri, 2 Jun 2017 19:32:01 +0000 (-0700) Subject: Fix JemallocNodumpAllocator extent_hooks API. X-Git-Tag: v2017.06.05.00~5 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=5fc76bd28960605eabe7334f23b77998c615a039;p=folly.git Fix JemallocNodumpAllocator extent_hooks API. Summary: Using extent_hooks mallctl to update hooks. Reviewed By: jasone Differential Revision: D5174623 fbshipit-source-id: 9313ee9ae55c85d973736077727e54a5825f4c3d --- diff --git a/folly/experimental/JemallocNodumpAllocator.cpp b/folly/experimental/JemallocNodumpAllocator.cpp index e2ce6d8c..8d29dbc8 100644 --- a/folly/experimental/JemallocNodumpAllocator.cpp +++ b/folly/experimental/JemallocNodumpAllocator.cpp @@ -89,7 +89,12 @@ bool JemallocNodumpAllocator::extend_and_setup_arena() { } // Set the custom hook - hooks->alloc = &JemallocNodumpAllocator::alloc; + extent_hooks_ = *hooks; + extent_hooks_.alloc = &JemallocNodumpAllocator::alloc; + if (auto ret = + mallctl(key.c_str(), nullptr, nullptr, &hooks, sizeof(hooks))) { + LOG(FATAL) << "Unable to set the hooks: " << errnoStr(ret); + } #endif return true; diff --git a/folly/experimental/JemallocNodumpAllocator.h b/folly/experimental/JemallocNodumpAllocator.h index 487a06b9..a87161f0 100644 --- a/folly/experimental/JemallocNodumpAllocator.h +++ b/folly/experimental/JemallocNodumpAllocator.h @@ -91,6 +91,7 @@ class JemallocNodumpAllocator { static void* alloc( void* chunk, #else + extent_hooks_t extent_hooks_; static extent_alloc_t* original_alloc_; static void* alloc( extent_hooks_t* extent,