Always allocate linear memory using mmap (#3052)
With this approach we can omit using memset() for the newly allocated memory therefore the physical pages are not being used unless touched by the program. This also simplifies the implementation.
This commit is contained in:
@ -132,7 +132,7 @@ enum {
|
||||
MMAP_MAP_32BIT = 1,
|
||||
/* Don't interpret addr as a hint: place the mapping at exactly
|
||||
that address. */
|
||||
MMAP_MAP_FIXED = 2
|
||||
MMAP_MAP_FIXED = 2,
|
||||
};
|
||||
|
||||
void *
|
||||
@ -142,6 +142,11 @@ os_munmap(void *addr, size_t size);
|
||||
int
|
||||
os_mprotect(void *addr, size_t size, int prot);
|
||||
|
||||
/* Doesn't guarantee that protection flags will be preserved.
|
||||
os_mprotect() must be called after remapping. */
|
||||
void *
|
||||
os_mremap(void *old_addr, size_t old_size, size_t new_size);
|
||||
|
||||
#if (WASM_MEM_DUAL_BUS_MIRROR != 0)
|
||||
void *
|
||||
os_get_dbus_mirror(void *ibus);
|
||||
|
||||
Reference in New Issue
Block a user