mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
fix build on msvc in C compilation; fix build with clang-cl on Windows
This commit is contained in:
parent
9ec5da08b2
commit
5764845c4d
4 changed files with 37 additions and 26 deletions
|
@ -603,7 +603,7 @@ static void mi_arenas_try_purge( bool force, bool visit_all )
|
|||
|
||||
// check if any arena needs purging?
|
||||
const mi_msecs_t now = _mi_clock_now();
|
||||
mi_msecs_t arenas_expire = mi_atomic_load_acquire(&mi_arenas_purge_expire);
|
||||
mi_msecs_t arenas_expire = mi_atomic_loadi64_acquire(&mi_arenas_purge_expire);
|
||||
if (!force && (arenas_expire == 0 || arenas_expire < now)) return;
|
||||
|
||||
const size_t max_arena = mi_atomic_load_acquire(&mi_arena_count);
|
||||
|
@ -614,7 +614,7 @@ static void mi_arenas_try_purge( bool force, bool visit_all )
|
|||
mi_atomic_guard(&purge_guard)
|
||||
{
|
||||
// increase global expire: at most one purge per delay cycle
|
||||
mi_atomic_store_release(&mi_arenas_purge_expire, now + mi_arena_purge_delay());
|
||||
mi_atomic_storei64_release(&mi_arenas_purge_expire, now + mi_arena_purge_delay());
|
||||
size_t max_purge_count = (visit_all ? max_arena : 2);
|
||||
bool all_visited = true;
|
||||
for (size_t i = 0; i < max_arena; i++) {
|
||||
|
@ -631,7 +631,7 @@ static void mi_arenas_try_purge( bool force, bool visit_all )
|
|||
}
|
||||
if (all_visited) {
|
||||
// all arena's were visited and purged: reset global expire
|
||||
mi_atomic_store_release(&mi_arenas_purge_expire, 0);
|
||||
mi_atomic_storei64_release(&mi_arenas_purge_expire, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ int _mi_prim_free(void* addr, size_t size ) {
|
|||
// In mi_os_mem_alloc_aligned the fallback path may have returned a pointer inside
|
||||
// the memory region returned by VirtualAlloc; in that case we need to free using
|
||||
// the start of the region.
|
||||
MEMORY_BASIC_INFORMATION info = { 0 };
|
||||
MEMORY_BASIC_INFORMATION info; _mi_memzero_var(info);
|
||||
VirtualQuery(addr, &info, sizeof(info));
|
||||
if (info.AllocationBase < addr && ((uint8_t*)addr - (uint8_t*)info.AllocationBase) < (ptrdiff_t)MI_SEGMENT_SIZE) {
|
||||
errcode = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue