aboutsummaryrefslogtreecommitdiffstats
path: root/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/masm/wtf/OSAllocatorPosix.cpp')
-rw-r--r--src/3rdparty/masm/wtf/OSAllocatorPosix.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
index a8990a92b4..5f95d0e9c8 100644
--- a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
+++ b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
@@ -114,11 +114,6 @@ void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable,
if (result == MAP_FAILED)
CRASH();
- while (madvise(result, bytes, MADV_DONTNEED)) {
- if (errno != EAGAIN)
- CRASH();
- }
-
if (fd != -1)
close(fd);
#else
@@ -250,8 +245,10 @@ void OSAllocator::decommit(void* address, size_t bytes)
mmap(address, bytes, PROT_NONE, MAP_FIXED | MAP_LAZY | MAP_PRIVATE | MAP_ANON, -1, 0);
#elif OS(LINUX)
while (madvise(address, bytes, MADV_DONTNEED)) {
- if (errno != EAGAIN)
- CRASH();
+ if (errno != EAGAIN) {
+ memset(address, 0, bytes); // We rely on madvise to zero-out the memory
+ break;
+ }
}
if (mprotect(address, bytes, PROT_NONE))
CRASH();