diff --git a/include/tscore/JeAllocator.h b/include/tscore/JeAllocator.h index c83ba0ba029..b67da12d0eb 100644 --- a/include/tscore/JeAllocator.h +++ b/include/tscore/JeAllocator.h @@ -67,6 +67,7 @@ class JemallocNodumpAllocator { public: void *allocate(InkFreeList *f); + void deallocate(InkFreeList *f, void *ptr); private: #if JEMALLOC_NODUMP_ALLOCATOR_SUPPORTED diff --git a/src/tscore/JeAllocator.cc b/src/tscore/JeAllocator.cc index 07ee5cfe1b0..31eb611d7f8 100644 --- a/src/tscore/JeAllocator.cc +++ b/src/tscore/JeAllocator.cc @@ -120,6 +120,22 @@ JemallocNodumpAllocator::allocate(InkFreeList *f) return newp; } +void +JemallocNodumpAllocator::deallocate(InkFreeList *f, void *ptr) +{ + if (f->advice) { +#if JEMALLOC_NODUMP_ALLOCATOR_SUPPORTED + if (likely(ptr)) { + dallocx(ptr, MALLOCX_TCACHE_NONE); + } +#else + ats_free(ptr); +#endif + } else { + ats_free(ptr); + } +} + JemallocNodumpAllocator & globalJemallocNodumpAllocator() { diff --git a/src/tscore/ink_queue.cc b/src/tscore/ink_queue.cc index 1f098e232a7..9dd4c7d9778 100644 --- a/src/tscore/ink_queue.cc +++ b/src/tscore/ink_queue.cc @@ -327,9 +327,11 @@ freelist_free(InkFreeList *f, void *item) static void malloc_free(InkFreeList *f, void *item) { - // Avoid compiler warnings - (void)f; - ats_free(item); + if (f->alignment) { + jna.deallocate(f, item); + } else { + ats_free(item); + } } void