mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-04 22:49:32 +03:00
Merge pull request #65 from devnexen/mi_mmap_prot_max_support
Using BSD new PROT_MAX mmap to block page address wider promotions
This commit is contained in:
commit
f06931ba7e
1 changed files with 5 additions and 1 deletions
6
src/os.c
6
src/os.c
|
@ -105,7 +105,11 @@ static void* mi_mmap(void* addr, size_t size, int extra_flags, mi_stats_t* stats
|
||||||
flags |= MAP_FIXED;
|
flags |= MAP_FIXED;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
p = mmap(addr, size, (PROT_READ | PROT_WRITE), flags, -1, 0);
|
int pflags = PROT_READ | PROT_WRITE;
|
||||||
|
#if defined(PROT_MAX)
|
||||||
|
pflags |= PROT_MAX(PROT_READ | PROT_WRITE); // BSD
|
||||||
|
#endif
|
||||||
|
p = mmap(addr, size, pflags, flags, -1, 0);
|
||||||
if (p == MAP_FAILED) p = NULL;
|
if (p == MAP_FAILED) p = NULL;
|
||||||
if (addr != NULL && p != addr) {
|
if (addr != NULL && p != addr) {
|
||||||
mi_munmap(p, size);
|
mi_munmap(p, size);
|
||||||
|
|
Loading…
Add table
Reference in a new issue