Note that there are some explanatory texts on larger screens.

plurals
  1. POMemory mapping, virtual and physical memory in C++
    primarykey
    data
    text
    <p>I am trying to solve the following issue: having a custom data container that manages a generic type, I need to allow for other application components to retrieve the container's internal pointer and use it as if it were a simple <code>T*</code> array region (without treating it as a more intelligent array holder). The problem is that this memory is, in a very special case, moved somewhere else and erased. So there are a plethora of components that are aware of the old data pointer and will use that one to access their required information. </p> <p>The setup looks, pseudo-codeish, something like this:</p> <pre><code>container&lt;T&gt; { T* ptr; public: ContainerInterfaceCode.. } </code></pre> <p><strong>Hypothesis:</strong></p> <p><code>T* ptr</code> is a pseudo-address (may I call it "virtual"?) which is mapped in a physical space A.</p> <p>When an event is risen, <code>T* ptr</code>'s mapping will be set for another physical space, B.</p> <p>Any component that uses <code>T* ptr</code> is then oblivious of the change of physical location, "thinking" its data is stored at that virtual address. </p> <p><strong>Conclusion:</strong></p> <p>I would therefore like to know <em>whether there is a mechanism involving memory mapping (virtual to physical) that will allow to juggle with the mapping of the <code>T* ptr</code></em>, thus leaving other application components untouched. Simply put, <code>T* ptr</code> should point to a memory region that gets mapped in a certain part, and, upon request, that same pointer will be mapped in another place (where the underlying data is to be copied for consistency). This must allow seamless transitions. </p> <p>Note: I can't use wrappers, smart pointers, handles, etc. for the simple fact that it means modifying a huge codebase just for one, rather minor, modification.</p> <p>As I haven't found enough resources dealing with this scenario, can anyone, perhaps, present a short webography with some relevant reading material on the subject?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload