Skip to content

Commit f8227ec

Browse files
committed
Merge pull request #388 from WebAssembly/rename-dont-need
Rename `dont_need` to `discard` and mention `decommit` as an option
2 parents 02de07b + 0f2f0c8 commit f8227ec

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

FutureFeatures.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ Provide access to safe OS-provided functionality including:
2222
copies the specified range from `Blob` into the range `[addr, addr+length)`
2323
(where `addr+length <= memory_size`) but implementations are encouraged
2424
to `mmap(addr, length, MAP_FIXED | MAP_PRIVATE, fd)`
25-
* `dont_need(addr, length)`: semantically, this operation zeroes the given range
26-
but the implementation is encouraged to `madvise(addr, length, MADV_DONTNEED)`
27-
(this allows applications to be good citizens and release unused physical
28-
pages back to the OS, thereby reducing their RSS and avoiding OOM-killing on
29-
mobile)
25+
* `discard(addr, length)`: semantically, this operation zeroes the given range
26+
but the implementation is encouraged to drop the zeroed physical pages from
27+
the process's working set (e.g., by calling `madvise(MADV_DONTNEED)` on
28+
POSIX)
3029
* `shmem_create(length)`: create a memory object that can be simultaneously
3130
shared between multiple linear memories
3231
* `map_shmem(addr, length, shmem, shmem-offset)`: like `map_file` except
3332
`MAP_SHARED`, which isn't otherwise valid on read-only Blobs
3433
* `mprotect(addr, length, prot-flags)`: change protection on the range
3534
`[addr, addr+length)` (where `addr+length <= memory_size`)
35+
* `decommit(addr, length)`: equivalent to `mprotect(addr, length, PROT_NONE)`
36+
followed by `discard(addr, length)` and potentially more efficient than
37+
performing these operations in sequence.
3638

3739
The `addr` and `length` parameters above would be required to be multiples of
3840
[`page_size`](AstSemantics.md#resizing).

0 commit comments

Comments
 (0)