Bug 1682947 - Use MADV_FREE_REUSE before using decommitted memory again on OSX, as per https://bugs.chromium.org/p/chromium/issues/detail?id=823915 r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D99932
This commit is contained in:
Steve Fink 2020-12-23 21:00:44 +00:00
parent 63c64ed972
commit 410cb65d7a

View File

@ -811,6 +811,11 @@ bool MarkPagesUnusedHard(void* region, size_t length) {
void MarkPagesInUseSoft(void* region, size_t length) {
CheckDecommit(region, length);
#if defined(XP_DARWIN)
while (madvise(region, length, MADV_FREE_REUSE) == -1 && errno == EAGAIN) {
}
#endif
MOZ_MAKE_MEM_UNDEFINED(region, length);
}