mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1732325 - SharedMemory::FindFreeAddressSpace should use MAP_NORESERVE r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D126510
This commit is contained in:
parent
b56ca950cf
commit
7ee3993e66
@ -489,6 +489,10 @@ bool SharedMemory::ReadOnlyCopy(SharedMemory* ro_out) {
|
||||
|
||||
#endif // not Android
|
||||
|
||||
#ifndef MAP_NORESERVE
|
||||
# define MAP_NORESERVE 0
|
||||
#endif
|
||||
|
||||
bool SharedMemory::Map(size_t bytes, void* fixed_address) {
|
||||
if (!mapped_file_) {
|
||||
return false;
|
||||
@ -517,8 +521,8 @@ bool SharedMemory::Map(size_t bytes, void* fixed_address) {
|
||||
}
|
||||
|
||||
void* SharedMemory::FindFreeAddressSpace(size_t size) {
|
||||
void* memory =
|
||||
mmap(NULL, size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
void* memory = mmap(nullptr, size, PROT_NONE,
|
||||
MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE, -1, 0);
|
||||
munmap(memory, size);
|
||||
return memory != MAP_FAILED ? memory : NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user