<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 13 Feb 2020 at 22:28, Ion GaztaƱaga via Boost-users &lt;<a href="mailto:boost-users@lists.boost.org">boost-users@lists.boost.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 30/01/2020 9:19, Gaier, Bjoern via Boost-users wrote:<br>
&gt; Hello Boost-Mailing-List,<br>
&gt; <br>
&gt; I have a question about the boost interprocess library - and I hope I <br>
&gt; can explain it correctly.<br>
&gt; <br>
&gt; I looked at the &quot;Quick guide for the impatient&quot; about the interprocess <br>
&gt; library - but I&#39;m not sure if I can use this for our purpose.<br>
&gt; <br>
&gt; The main goal is to insert a STL vector (or different container) in a <br>
&gt; predefined portion of an already existing shared memory. The main <br>
&gt; problem is, that we cannot use the managed_shared_memory code from <br>
&gt; boost, because we rely on a different API to allocate the shared memory <br>
&gt; between Windows and other devices. Also the container should be placed <br>
&gt; at a fixed offset inside the created shared memory.<br>
&gt; <br>
&gt; I&#39;m a complete newbie with boost and the interprocess library, that is <br>
&gt; why I&#39;m not sure which interface I have to provide for the interprocess <br>
&gt; vector to be setup correctly. I hoped I could do something like:<br>
&gt; <br>
&gt; new (srh_mem_base + offset) boost::interprocess::vector&lt;allocator&gt;;<br>
&gt; <br>
&gt; I tried looking into the headers of the library to get an idea of that, <br>
&gt; but I honestly got lost.<br>
&gt; <br>
&gt; I&#39;m really sorry if this a stupid or obvious question - and I thank for <br>
&gt; any help in advance!<br>
<br>
Unfortunatelly does not going to work. A shared memory vector expects a <br>
shared memory allocator that relies on the segment_manager class.</blockquote><div><br></div><div>In the specific case of a vector, wouldn&#39;t it be simpler to allocate directly (a wrapper around VM) from Virtual Memory(i.e. without the segment manager, as there don&#39;t have to be segments, and there is nothing to manage), and there is nothing to relocate (ever, if you make the virtual reserved space adequately large)? <br></div><div><br></div><div>This is just an idea I&#39;ve been thinking about (for my own purposes). What would be against this approach?</div><div><br></div><div>degski<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> That <br>
class expects a managed shared memory (or mapped file) that resolves <br>
allocation requests looking for free space in the managed shared memory <br>
segment.<br>
<br>
You would need to define a new allocator and managed shared memory  (as <br>
you need to handle the allocation requests from the vector) that <br>
fulfills your needs. Not an easy task at all.<br>
<br>
For fixed offsets, you&#39;d better avoid Interprocess and use an array or <br>
similar with no dynamic allocations.<br>
<br>
Best,<br>
<br>
Ion<br>
_______________________________________________<br>
Boost-users mailing list<br>
<a href="mailto:Boost-users@lists.boost.org" target="_blank">Boost-users@lists.boost.org</a><br>
<a href="https://lists.boost.org/mailman/listinfo.cgi/boost-users" rel="noreferrer" target="_blank">https://lists.boost.org/mailman/listinfo.cgi/boost-users</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">@realdegski</div><div dir="ltr"><a href="https://brave.com/google-gdpr-workaround/" target="_blank">https://brave.com/google-gdpr-workaround/</a></div><div>&quot;We value your privacy, click here!&quot; Sod off! - degski<br></div><div dir="ltr">&quot;Anyone who believes that exponential growth can go on forever in a finite world is either a madman or an economist&quot; - Kenneth E. Boulding</div><div dir="ltr">&quot;Growth for the sake of growth is the ideology of the cancer cell&quot; - Edward P. Abbey<br></div></div></div></div></div></div></div></div></div></div></div></div></div>