Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-115706

QFile should provide a method to detach memory mappings

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • Some future release
    • Active Qt
    • None
    • All

    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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            owolff Oliver Wolff
            oshbug . .
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes