The map_file_from_path
proc is useful to memory map files. On Windows it calls the MapViewOfFile
to map the contents of the file to a virtual address range. But the release proc never calls the UnmapViewOfFile
to unmap that address range. Instead it tries to release using the VirtualFree
function. But this MSDN doc page states that VirtualFree cannot be used to free the address range when it is mapped to a file.
After a page from the reserved range is committed, it cannot be freed or decommitted by calling VirtualFree. Reserved and committed pages are released when the view is unmapped and the file mapping object is closed. For details, see the UnmapViewOfFileand CloseHandle functions.
Source https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-mapviewoffile
I want to see if this is indeed a bug or am I missing something?