Skip to content

Commit 39f5774

Browse files
duke8253zwoop
authored andcommitted
call je_dallocx with flags when needed (#8547)
(cherry picked from commit 59b7081)
1 parent 3c07a02 commit 39f5774

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

include/tscore/JeAllocator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class JemallocNodumpAllocator
6767
{
6868
public:
6969
void *allocate(InkFreeList *f);
70+
void deallocate(InkFreeList *f, void *ptr);
7071

7172
private:
7273
#if JEMALLOC_NODUMP_ALLOCATOR_SUPPORTED

src/tscore/JeAllocator.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,22 @@ JemallocNodumpAllocator::allocate(InkFreeList *f)
120120
return newp;
121121
}
122122

123+
void
124+
JemallocNodumpAllocator::deallocate(InkFreeList *f, void *ptr)
125+
{
126+
if (f->advice) {
127+
#if JEMALLOC_NODUMP_ALLOCATOR_SUPPORTED
128+
if (likely(ptr)) {
129+
dallocx(ptr, MALLOCX_TCACHE_NONE);
130+
}
131+
#else
132+
ats_free(ptr);
133+
#endif
134+
} else {
135+
ats_free(ptr);
136+
}
137+
}
138+
123139
JemallocNodumpAllocator &
124140
globalJemallocNodumpAllocator()
125141
{

src/tscore/ink_queue.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,11 @@ freelist_free(InkFreeList *f, void *item)
327327
static void
328328
malloc_free(InkFreeList *f, void *item)
329329
{
330-
// Avoid compiler warnings
331-
(void)f;
332-
ats_free(item);
330+
if (f->alignment) {
331+
jna.deallocate(f, item);
332+
} else {
333+
ats_free(item);
334+
}
333335
}
334336

335337
void

0 commit comments

Comments
 (0)