This commit is contained in:
Robin Lambertz 2025-06-02 21:54:12 +03:00 committed by GitHub
commit 91ef5ee427
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -28,12 +28,31 @@
/******************************************************************************/
/* Data. */
#ifdef _MSC_VER
#define STR(s) #s
#define XSTR(s) STR(s)
#endif
/* Runtime configuration options. */
#ifndef _MSC_VER
const char *je_malloc_conf
#ifndef _WIN32
JEMALLOC_ATTR(weak)
#endif
;
#else
extern const char *je_malloc_conf;
const char *malloc_conf_default = NULL;
#if defined (_M_IX86)
// NOTE: The JEMALLOC_PRIVATE_NAMESPACE does not get applied properly on 32-bit
// windows, presumably due to the leading underscore being automatically added
// to all symbols.
#pragma comment(linker, "/alternatename:_" XSTR(je_malloc_conf) "=_malloc_conf_default")
#else
#pragma comment(linker, "/alternatename:" XSTR(je_malloc_conf) "=" XSTR(JEMALLOC_PRIVATE_NAMESPACE) "malloc_conf_default")
#endif
#endif
/*
* The usual rule is that the closer to runtime you are, the higher priority
* your configuration settings are (so the jemalloc config options get lower
@ -51,11 +70,24 @@ const char *je_malloc_conf
* We don't actually want this to be widespread, so we'll give it a silly name
* and not mention it in headers or documentation.
*/
#ifndef _MSC_VER
const char *je_malloc_conf_2_conf_harder
#ifndef _WIN32
JEMALLOC_ATTR(weak)
#endif
;
#else
extern const char *je_malloc_conf_2_conf_harder;
const char *malloc_conf_2_conf_harder_default = NULL;
#if defined (_M_IX86)
// NOTE: The JEMALLOC_PRIVATE_NAMESPACE does not get applied properly on 32-bit
// windows, presumably due to the leading underscore being automatically added
// to all symbols.
#pragma comment(linker, "/alternatename:_" XSTR(je_malloc_conf_2_conf_harder) "=_malloc_conf_2_conf_harder_default")
#else
#pragma comment(linker, "/alternatename:" XSTR(je_malloc_conf_2_conf_harder) "=" XSTR(JEMALLOC_PRIVATE_NAMESPACE) "malloc_conf_2_conf_harder_default")
#endif
#endif
const char *opt_malloc_conf_symlink = NULL;
const char *opt_malloc_conf_env_var = NULL;