Describe the bug
There was a bug that I fixed that involved mapping memory regions of a certain size (BYU-PCCL/holodeck-engine#175). The code would try and create the shared memory file, but if it already existed, it would just use the existing one (CreateFileMapping). Then it would try and map that file to a memory region of a fixed size (MapViewOfFile). That second call would occasionally fail because the size of the file mapping and the size passed into MapViewOfFile differed apparently (I couldn't verify this - I couldn't find a way to see how large a CreateFileMapping was if it was already created)
The fix was to change the MapViewOfFile call to not specify a size (0 as the last parameter) and use the size it already was. This appears to work, but doesn't explain why the sizes didn't match (the Python code had already created the memory region)
To Reproduce
Look in the log for this message
HolodeckSharedMemory:: Unable to create MemFile! The path %s already exists. Hopefully it is the correct size...
Expected behavior
The memory regions should be the same size, and we should be able to pass the size of the memory into MapViewOfFile
Describe the bug There was a bug that I fixed that involved mapping memory regions of a certain size (BYU-PCCL/holodeck-engine#175). The code would try and create the shared memory file, but if it already existed, it would just use the existing one (
CreateFileMapping
). Then it would try and map that file to a memory region of a fixed size (MapViewOfFile
). That second call would occasionally fail because the size of the file mapping and the size passed intoMapViewOfFile
differed apparently (I couldn't verify this - I couldn't find a way to see how large aCreateFileMapping
was if it was already created)The fix was to change the
MapViewOfFile
call to not specify a size (0
as the last parameter) and use the size it already was. This appears to work, but doesn't explain why the sizes didn't match (the Python code had already created the memory region)To Reproduce Look in the log for this message
Expected behavior The memory regions should be the same size, and we should be able to pass the size of the memory into
MapViewOfFile