I don't understand the difference between MEM_RELEASE and MEM_DECOMMIT in the Windows VirtualFree function.
Conversation
Replying to
MEM_RELEASE will free the mapping completely like munmap on Linux, making the address space usable for other things.
MEM_DECOMMIT will release the memory but hold onto the reserve address space like clobbering a mapping with mmap + MAP_FIXED + PROT_NONE on Linux.
2
2
MEM_DECOMMIT is the same as making a fresh mapping with VirtualAlloc using MEM_RESERVE.
You go from a reserved mapping to usable memory with MEM_COMMIT like using mprotect for that purpose on Linux. Windows separates the concept of whether it's committed from protection mode.
Replying to
So, for example, you may have a case where you need up to 256GB of contiguous memory. It's perfectly fine to reserve that much memory on 64-bit. The only way you could commit that much memory is if you actually had that much physical memory + swap. Windows enforces having enough.
1
1
Show replies

