-
Notifications
You must be signed in to change notification settings - Fork 662
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
Add support for compiling with mimalloc #363
base: unstable
Are you sure you want to change the base?
Changes from 22 commits
8f202d2
4bdc923
c5d5199
0d7c60a
743d978
2778f3b
9fc71a3
08684da
f144dc0
345e7a6
9f93823
c4b890a
1f1ca13
4a39d8c
658aec3
f16f92f
32d07dd
fcc724b
1219f1c
0438848
65ef92f
371641d
b1431fa
2f00910
c9c3733
a594b55
2466cb4
1854578
e391645
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ | |
|
||
#if defined(USE_TCMALLOC) | ||
#define ZMALLOC_LIB ("tcmalloc-" __xstr(TC_VERSION_MAJOR) "." __xstr(TC_VERSION_MINOR)) | ||
#define defrag_supported "no" | ||
#include <google/tcmalloc.h> | ||
#if (TC_VERSION_MAJOR == 1 && TC_VERSION_MINOR >= 6) || (TC_VERSION_MAJOR > 1) | ||
#define HAVE_MALLOC_SIZE 1 | ||
|
@@ -47,6 +48,7 @@ | |
|
||
#elif defined(USE_JEMALLOC) | ||
#define ZMALLOC_LIB ("jemalloc-" __xstr(JEMALLOC_VERSION_MAJOR) "." __xstr(JEMALLOC_VERSION_MINOR) "." __xstr(JEMALLOC_VERSION_BUGFIX)) | ||
#define defrag_supported "yes" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would rather simply compare the allocator, if it's JEMALLOC print yes else no for now. Won't require us to add another macro. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, good suggestion:) I will update in server.c file: directly check which memory allocator is being used, avoids introducing new macros. |
||
#include <jemalloc/jemalloc.h> | ||
#if (JEMALLOC_VERSION_MAJOR == 2 && JEMALLOC_VERSION_MINOR >= 1) || (JEMALLOC_VERSION_MAJOR > 2) | ||
#define HAVE_MALLOC_SIZE 1 | ||
|
@@ -55,6 +57,20 @@ | |
#error "Newer version of jemalloc required" | ||
#endif | ||
|
||
#elif defined(USE_MIMALLOC) | ||
#define defrag_supported "no" | ||
#include <mimalloc.h> | ||
#define ZMALLOC_LIB ("mimalloc-" __xstr(MI_MALLOC_VERSION)) | ||
#define MI_VERSION_MAJOR (MI_MALLOC_VERSION / 100) | ||
#define MI_VERSION_MINOR ((MI_MALLOC_VERSION / 10) % 10) | ||
#define MI_VERSION_PATCH (MI_MALLOC_VERSION % 10) | ||
#if (MI_VERSION_MAJOR == 1 && MI_VERSION_MINOR >= 8) || (MI_VERSION_PATCH > 1) | ||
#define HAVE_MALLOC_SIZE 1 | ||
#define zmalloc_size(p) mi_usable_size(p) | ||
#else | ||
#error "Newer version of mimalloc required" | ||
#endif | ||
|
||
#elif defined(__APPLE__) | ||
#include <malloc/malloc.h> | ||
#define HAVE_MALLOC_SIZE 1 | ||
|
@@ -73,6 +89,10 @@ | |
#define ZMALLOC_LIB "libc" | ||
#define USE_LIBC 1 | ||
|
||
#ifndef defrag_supported | ||
#define defrag_supported "no" | ||
#endif | ||
|
||
#if !defined(NO_MALLOC_USABLE_SIZE) && \ | ||
(defined(__GLIBC__) || defined(__FreeBSD__) || \ | ||
defined(__DragonFly__) || defined(__HAIKU__) || \ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a tcl test to verify the behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in
other.tcl
file.