Skip to content

Commit

Permalink
proper macos settings hopefully now
Browse files Browse the repository at this point in the history
  • Loading branch information
lnkuiper committed Aug 8, 2024
1 parent e5cea33 commit 6739f3f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
3 changes: 2 additions & 1 deletion extension/jemalloc/jemalloc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ set(JEMALLOC_C_FILES
src/ticker.c
src/tsd.c
src/util.c
src/witness.c)
src/witness.c
src/zone.c)

# if we add this jemalloc overrides new/delete
# would be great but causes trouble in our Python client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,22 @@
/*
* Defined if issetugid(2) is available.
*/
// #define JEMALLOC_HAVE_ISSETUGID
#ifdef __APPLE__
#define JEMALLOC_HAVE_ISSETUGID
#endif

/* Defined if pthread_atfork(3) is available. */
#ifdef __GLIBC__
#ifndef _MSC_VER
#define JEMALLOC_HAVE_PTHREAD_ATFORK
#endif

/* Defined if pthread_setname_np(3) is available. */
// #define JEMALLOC_HAVE_PTHREAD_SETNAME_NP

/* Defined if pthread_getname_np(3) is available. */
// #define JEMALLOC_HAVE_PTHREAD_GETNAME_NP
#ifdef __APPLE__
#define JEMALLOC_HAVE_PTHREAD_GETNAME_NP
#endif

/* Defined if pthread_set_name_np(3) is available. */
/* #undef JEMALLOC_HAVE_PTHREAD_SET_NAME_NP */
Expand All @@ -139,7 +143,9 @@
/*
* Defined if mach_absolute_time() is available.
*/
// #define JEMALLOC_HAVE_MACH_ABSOLUTE_TIME
#ifdef __APPLE__
#define JEMALLOC_HAVE_MACH_ABSOLUTE_TIME
#endif

/*
* Defined if clock_gettime(CLOCK_REALTIME, ...) is available.
Expand Down Expand Up @@ -339,7 +345,7 @@
* If defined, explicitly attempt to more uniformly distribute large allocation
* pointer alignments across all cache indices.
*/
// #define JEMALLOC_CACHE_OBLIVIOUS
#define JEMALLOC_CACHE_OBLIVIOUS

/*
* If defined, enable logging facilities. We make this a configure option to
Expand All @@ -362,20 +368,20 @@
/*
* Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
*/
// #if defined(__APPLE__)
// #define JEMALLOC_ZONE
// #endif
#if defined(__APPLE__)
#define JEMALLOC_ZONE
#endif

/*
* Methods for determining whether the OS overcommits.
* JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY: Linux's
* /proc/sys/vm.overcommit_memory file.
* JEMALLOC_SYSCTL_VM_OVERCOMMIT: FreeBSD's vm.overcommit sysctl.
*/
#if defined(__FreeBSD__)
#define JEMALLOC_SYSCTL_VM_OVERCOMMIT
#else
#if defined(__linux__)
#define JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY
#elif defined(__FreeBSD__)
#define JEMALLOC_SYSCTL_VM_OVERCOMMIT
#endif

/* Defined if madvise(2) is available. */
Expand Down Expand Up @@ -498,7 +504,9 @@
#define JEMALLOC_HAVE_PTHREAD

/* dlsym() support */
// #define JEMALLOC_HAVE_DLSYM
#ifndef _MSC_VER
#define JEMALLOC_HAVE_DLSYM
#endif

/* Adaptive mutex support in pthreads. */
/* #undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */
Expand Down Expand Up @@ -549,9 +557,9 @@
/* #undef JEMALLOC_UAF_DETECTION */

/* Darwin VM_MAKE_TAG support */
// #if defined(__APPLE__)
// #define JEMALLOC_HAVE_VM_MAKE_TAG
// #endif
#if defined(__APPLE__)
#define JEMALLOC_HAVE_VM_MAKE_TAG
#endif

/* If defined, realloc(ptr, 0) defaults to "free" instead of "alloc". */
#ifdef __GLIBC__
Expand Down
6 changes: 3 additions & 3 deletions extension/jemalloc/jemalloc/src/zone.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

#include "jemalloc/internal/assert.h"

#ifndef JEMALLOC_ZONE
# error "This source file is for zones on Darwin (OS X)."
#endif
#ifdef JEMALLOC_ZONE

/* Definitions of the following structs in malloc/malloc.h might be too old
* for the built binary to run on newer versions of OSX. So use the newest
Expand Down Expand Up @@ -467,3 +465,5 @@ zone_register(void) {
/* Promote the custom zone to be default. */
zone_promote();
}

#endif
1 change: 1 addition & 0 deletions extension/jemalloc/jemalloc_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@
'extension/jemalloc/jemalloc/src/tsd.c',
'extension/jemalloc/jemalloc/src/util.c',
'extension/jemalloc/jemalloc/src/witness.c',
'extension/jemalloc/jemalloc/src/zone.c',
]
]

0 comments on commit 6739f3f

Please sign in to comment.