Skip to content

Commit 8141f01

Browse files
committed
Revert "update windows vmZeroAndPurge"
This reverts commit 38f788c.
1 parent 3cd5624 commit 8141f01

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Source/bmalloc/bmalloc/VMAllocate.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -387,14 +387,8 @@ inline void vmZeroAndPurge(void* p, size_t vmSize, VMTag usage)
387387
BUNUSED_PARAM(usage);
388388

389389
vmValidate(p, vmSize);
390-
// DiscardVirtualMemory does not guarantee zeroing and fails on memory
391-
// managed by libpas within reserved Gigacage regions. Use decommit+recommit
392-
// which releases physical pages and provides demand-zeroed pages on next
393-
// access, matching the behavior of mmap(MAP_FIXED|MAP_ANON) on Unix.
394-
BOOL success = VirtualFree(p, vmSize, MEM_DECOMMIT);
395-
RELEASE_BASSERT(success);
396-
void* result = VirtualAlloc(p, vmSize, MEM_COMMIT, PAGE_READWRITE);
397-
RELEASE_BASSERT(result == p);
390+
DWORD result = DiscardVirtualMemory(p, vmSize);
391+
RELEASE_BASSERT(result == ERROR_SUCCESS);
398392
}
399393

400394
inline void vmDeallocatePhysicalPages(void* p, size_t vmSize)

0 commit comments

Comments
 (0)