[Boost-bugs] [Boost C++ Libraries] #9019: Bug: mapped_region shouldn't create a new file mapping but reuse the one provided in file_mapping

Subject: [Boost-bugs] [Boost C++ Libraries] #9019: Bug: mapped_region shouldn't create a new file mapping but reuse the one provided in file_mapping
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-08-20 16:17:21


#9019: Bug: mapped_region shouldn't create a new file mapping but reuse the one
provided in file_mapping
-------------------------------------------------+-------------------------
 Reporter: michal.fronczyk@… | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component:
  Version: Boost 1.54.0 | interprocess
 Keywords: interprocess mapped_region | Severity:
  file_mapping | Optimization
-------------------------------------------------+-------------------------
 In the constructor of the mapped_region class there is the following code:

 {{{
 native_mapping_handle = winapi::create_file_mapping
             (
 ipcdetail::file_handle_from_mapping_handle(mapping.get_mapping_handle())
             , protection, 0, 0, 0);
 }}}

 followed by the following:


 {{{
 void *base = winapi::map_view_of_file_ex
                                  (native_mapping_handle,
                                  map_access,
                                  offset - page_offset,
                                  static_cast<std::size_t>(page_offset +
 size),
                                  const_cast<void*>(address));
 }}}

 Each invocation of the mapped_region's class constructor creates a new
 mapping. I think the code that creates the file mapping should be moved to
 the file_mapping class, so multiple mapped_regions could reuse the same
 file mapping. Currently, even if the same file_mapping instance is passed
 to the mapped_region's constructor, the file mapping isn't reused which
 makes creating multiple mapped regions of the same file slow.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9019>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC