From 7c9e64a0cf44be563abdad056e45e8268e99ee0a Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Thu, 8 Jun 2017 10:26:32 -0700 Subject: [PATCH] make extent_hooks static. Summary: Make extent hooks static and avoid calling arena_destroy, in case there are alive allocations not freed yet. Reviewed By: yfeldblum Differential Revision: D5208102 fbshipit-source-id: 612c772347cd90227fa303fd0b059edbaeb7d4e2 --- folly/experimental/JemallocNodumpAllocator.cpp | 14 +------------- folly/experimental/JemallocNodumpAllocator.h | 3 +-- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/folly/experimental/JemallocNodumpAllocator.cpp b/folly/experimental/JemallocNodumpAllocator.cpp index 77d9724b..481efd00 100644 --- a/folly/experimental/JemallocNodumpAllocator.cpp +++ b/folly/experimental/JemallocNodumpAllocator.cpp @@ -29,19 +29,6 @@ JemallocNodumpAllocator::JemallocNodumpAllocator(State state) { } } -JemallocNodumpAllocator::~JemallocNodumpAllocator() { -#ifdef FOLLY_JEMALLOC_NODUMP_ALLOCATOR_EXTENT - if (arena_index_ != 0) { - // Destroy the arena because the hooks are linked to us. - const auto key = folly::to("arena.", arena_index_, ".destroy"); - if (auto ret = mallctl(key.c_str(), nullptr, 0, nullptr, 0)) { - LOG(FATAL) << "Unable to destroy arena: " << errnoStr(ret); - } - LOG(INFO) << "Destroy arena: " << arena_index_; - } -#endif -} - bool JemallocNodumpAllocator::extend_and_setup_arena() { #ifdef FOLLY_JEMALLOC_NODUMP_ALLOCATOR_SUPPORTED if (mallctl == nullptr) { @@ -132,6 +119,7 @@ chunk_alloc_t* JemallocNodumpAllocator::original_alloc_ = nullptr; void* JemallocNodumpAllocator::alloc( void* chunk, #else +extent_hooks_t JemallocNodumpAllocator::extent_hooks_; extent_alloc_t* JemallocNodumpAllocator::original_alloc_ = nullptr; void* JemallocNodumpAllocator::alloc( extent_hooks_t* extent, diff --git a/folly/experimental/JemallocNodumpAllocator.h b/folly/experimental/JemallocNodumpAllocator.h index 40ebe99e..e6756aa1 100644 --- a/folly/experimental/JemallocNodumpAllocator.h +++ b/folly/experimental/JemallocNodumpAllocator.h @@ -76,7 +76,6 @@ class JemallocNodumpAllocator { static void deallocate(void* p, void* userData); explicit JemallocNodumpAllocator(State state = State::ENABLED); - ~JemallocNodumpAllocator(); void* allocate(size_t size); void* reallocate(void* p, size_t size); @@ -92,7 +91,7 @@ class JemallocNodumpAllocator { static void* alloc( void* chunk, #else - extent_hooks_t extent_hooks_; + static extent_hooks_t extent_hooks_; static extent_alloc_t* original_alloc_; static void* alloc( extent_hooks_t* extent, -- 2.34.1