mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-08 00:09:31 +03:00
name anonymous mmap address ranges
This commit is contained in:
parent
2fc6b14bab
commit
c675fd7f57
1 changed files with 9 additions and 2 deletions
|
@ -217,7 +217,10 @@ static void* unix_mmap_prim(void* addr, size_t size, size_t try_alignment, int p
|
|||
int err = errno;
|
||||
_mi_trace_message("unable to directly request aligned OS memory (error: %d (0x%x), size: 0x%zx bytes, alignment: 0x%zx, hint address: %p)\n", err, err, size, try_alignment, addr);
|
||||
}
|
||||
if (p!=MAP_FAILED) return p;
|
||||
if (p!=MAP_FAILED) {
|
||||
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, size, "mimalloc");
|
||||
return p;
|
||||
}
|
||||
// fall back to regular mmap
|
||||
}
|
||||
}
|
||||
|
@ -242,13 +245,17 @@ static void* unix_mmap_prim(void* addr, size_t size, size_t try_alignment, int p
|
|||
#endif
|
||||
_mi_trace_message("unable to directly request hinted aligned OS memory (error: %d (0x%x), size: 0x%zx bytes, alignment: 0x%zx, hint address: %p)\n", err, err, size, try_alignment, hint);
|
||||
}
|
||||
if (p!=MAP_FAILED) return p;
|
||||
if (p!=MAP_FAILED) {
|
||||
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, size, "mimalloc");
|
||||
return p;
|
||||
}
|
||||
// fall back to regular mmap
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// regular mmap
|
||||
p = mmap(addr, size, protect_flags, flags, fd, 0);
|
||||
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, size, "mimalloc");
|
||||
if (p!=MAP_FAILED) return p;
|
||||
// failed to allocate
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Reference in a new issue