In my application, one file on disk is created and memory mapped with an initial size. If I apply a second memory mapping to the file, with a larger size, the file expands to the new size. Windows lets me do this without error but I don't know if it's actually kosher. Are there any problems with a second memory mapping with a larger size?
The CreateFileMapping documentation has this to say:
After a file mapping object is created, the size of the file must not exceed the size of the file mapping object; if it does, not all of the file contents are available for sharing.
This would appear to imply (since no other downsides or prohibitions are mentioned) that the only side effect of mapping a file a second time with a larger size is that the first mapping won't be able to see the whole thing (obviously).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With