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.
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 callmark_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 toPROT_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.