Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call je_dallocx with flags when needed #8547

Merged
merged 1 commit into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/tscore/JeAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class JemallocNodumpAllocator
{
public:
void *allocate(InkFreeList *f);
void deallocate(InkFreeList *f, void *ptr);

private:
#if JEMALLOC_NODUMP_ALLOCATOR_SUPPORTED
Expand Down
16 changes: 16 additions & 0 deletions src/tscore/JeAllocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
8 changes: 5 additions & 3 deletions src/tscore/ink_queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down