Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7420: If I call managed_shared_memory() function when I create a lot of objects, it ocurrs error.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-10-08 20:49:13
#7420: If I call managed_shared_memory() function when I create a lot of objects,
it ocurrs error.
-------------------------------+--------------------------------------------
Reporter: anonymous | Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.47.0 | Severity: Problem
Resolution: | Keywords: interprocess, shared_memeory
-------------------------------+--------------------------------------------
Comment (by igaztanaga):
Thanks for the report. First of all, creating so many shared memory
segments it's not very likely. If you would want to emulate it with plain
files, you'll need to open too many files. 10.000 managed segments at the
same time, seems too high IMHO.
However, I can't remember right now the exact reason why StoreDevice
needed to be true for shared memory managed segments. It is need for
xsi_shared memory and not for windows_shared_memory.
As a test, you could modify basic_managed_shared_memory (in
managed_shared_memory.hpp) and change:
, private ipcdetail::managed_open_or_create_impl<shared_memory_object
,
AllocationAlgorithm::Alignment>
with
, private ipcdetail::managed_open_or_create_impl<shared_memory_object
,
AllocationAlgorithm::Alignment, true, false>
(that is, FileBased = true and StoreDevice = false)
let me know if that fixes the problem.
In Boost 1.52, mapped_region will hold a file descriptor in windows, to
allow implementing blocking flush() in windows (as we need to call
FlushFileBuffers() with a file descriptor), so there will be another open
file descriptor. If you know an alternative to avoid maintaining an open
file descriptor only for this purpose, please let me know.
In Unix, after mmap the file descriptor can be closed, as according to
POSIX:
"The mmap() function shall add an extra reference to the file associated
with the file descriptor fildes which is not removed by a subsequent
close() on that file descriptor. This reference shall be removed when
there are no more mappings to the file."
Please let me know if you find any problems with the proposed change
and/or soon to be released Boost 1.52
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7420#comment:4> 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:10 UTC