Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
Some future release
-
None
Description
Currently, QFile has methods map() and unmap() for creating and freeing memory mappings for files. However according to the documentation
When the QFile is destroyed or a new file is opened with this object, any maps that have not been unmapped will automatically be unmapped.
This is somewhat inconvenient, since it means we cannot keep the mapping valid unless we keep the QFile alive for at least as long as the mapping, making returning the mapping tricky...
It is already legitimate to close the QFile after mapping it - it seems to me that it would further increase ease of use to allow the mapping to be detached from the file, either via a flag at creation or via a detach() member function called after mapping. Then the mapping could outlive the QFile, and be unmapped later via a static QFile::unmap() method or similar.