+#else
+ const auto key =
+ folly::to<std::string>("arena.", arena_index_, ".extent_hooks");
+ extent_hooks_t* hooks;
+ len = sizeof(hooks);
+ // Read the existing hooks
+ if (auto ret = mallctl(key.c_str(), &hooks, &len, nullptr, 0)) {
+ LOG(FATAL) << "Unable to get the hooks: " << errnoStr(ret);
+ }
+ if (original_alloc_ == nullptr) {
+ original_alloc_ = hooks->alloc;
+ } else {
+ DCHECK_EQ(original_alloc_, hooks->alloc);
+ }
+
+ // Set the custom hook
+ extent_hooks_ = *hooks;
+ extent_hooks_.alloc = &JemallocNodumpAllocator::alloc;
+ extent_hooks_t* new_hooks = &extent_hooks_;
+ if (auto ret = mallctl(
+ key.c_str(), nullptr, nullptr, &new_hooks, sizeof(new_hooks))) {
+ LOG(FATAL) << "Unable to set the hooks: " << errnoStr(ret);
+ }
+#endif