mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-24 08:03:32 +03:00
Optimizations for Windows
- Set opt_lg_chunk based on run-time OS setting - Verify LG_PAGE is compatible with run-time OS setting - When targeting Windows Vista or newer, use SRWLOCK instead of CRITICAL_SECTION - When targeting Windows Vista or newer, statically initialize init_lock
This commit is contained in:
parent
241abc601b
commit
a1aaf949a5
4 changed files with 36 additions and 2 deletions
|
|
@ -175,6 +175,9 @@ static bool malloc_initializer = NO_INITIALIZER;
|
|||
|
||||
/* Used to avoid initialization races. */
|
||||
#ifdef _WIN32
|
||||
#if _WIN32_WINNT >= 0x0600
|
||||
static malloc_mutex_t init_lock = SRWLOCK_INIT;
|
||||
#else
|
||||
static malloc_mutex_t init_lock;
|
||||
|
||||
JEMALLOC_ATTR(constructor)
|
||||
|
|
@ -190,7 +193,7 @@ _init_init_lock(void)
|
|||
JEMALLOC_SECTION(".CRT$XCU") JEMALLOC_ATTR(used)
|
||||
static const void (WINAPI *init_init_lock)(void) = _init_init_lock;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#else
|
||||
static malloc_mutex_t init_lock = MALLOC_MUTEX_INITIALIZER;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue