ezrosent / allocators-rs

Allocators in Rust
Apache License 2.0
311 stars 28 forks source link

mmap-alloc: Implement mark_unused for Windows #72

Closed joshlf closed 7 years ago

joshlf commented 7 years ago

On Linux and Mac, we have a mark_unused function that is used when a mapping call returns 0. In this case, we request a different mapping, but leave the 0 page mapped so that future calls will never return that page again. In order to make bugs easier to find and to avoid wasting resources, we call mark_unused on the page, which informs the kernel that we don't need a physical page to back it, and sets the page's permissions to PROT_NONE so that any future accesses will result in a segfault.

Equivalents to this behavior probably exist on Windows, so we should implement mark_unused for Windows as well.