• Clemens Hammacher's avatar
    [wasm][gc] Make pages inaccessible instead of discarding them · 33dc36d7
    Clemens Hammacher authored
    On Linux, both APIs uses {madvise} (and {SetPermissions} additionally
    does an {mprotect}), on windows they use different APIs. It turns out that
    {SetPermissions} with {kNoAccess} uses {VirtualFree} with
    {MEM_DECOMMIT}, so the pages will only be "reserved" afterwards.
    {DiscardSystemPages} on the other hand uses the {DiscardVirtualMemory}
    which tells the OS that the content of that memory can be discarded,
    but the pages stay "committed".
    Thus {SetPermissions} with {kNoAccess} frees significantly more memory
    than using {DiscardSystemPages}.
    
    R=mstarzinger@chromium.org
    
    Bug: v8:8217
    Change-Id: I3555462a9c692f15ecb3eca7834eb181617d9ef9
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1730992Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
    Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#63029}
    33dc36d7
wasm-code-manager.cc 62.6 KB