}
// Set the custom hook
- hooks->alloc = &JemallocNodumpAllocator::alloc;
+ 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
return true;
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,