title: Segmentation fault after mmap()
body: <p>I wanna share a pointer of map during 2 processes. So I tried mmap. I tested mmap in a single process. Here is my code:</p>
  
  <pre><code>#include  &lt;vector&gt;
  #include  &lt;iostream&gt;
  #include  &lt;sys/mman.h&gt;
  #include  &lt;unistd.h&gt;
  #include  &lt;cstdlib&gt;
  #include  &lt;stdio.h&gt;
  #include  &lt;map&gt;
  using namespace std;
  
  int main(int argc, char *argv[])
  {
      map&lt;string,string&gt; a, *b;
  
      b = (map&lt;string,string&gt; *)mmap(&amp;a,sizeof(map&lt;string,string&gt;),
          PROT_READ|PROT_WRITE,MAP_ANON|MAP_SHARED,-1,0);
  
      b-&gt;insert(map&lt;string,string&gt;::value_type("a","b")); //error 
      cout &lt;&lt; b-&gt;size() &lt;&lt; endl;
  }
  </code></pre>
  
  <p>when it runs to <code>b-&gt;insert()</code>, Segmentation fault occured. If I remove <code>b-&gt;insert()</code>, there is no error (still have <code>b-&gt;size</code>). What's the problem with my code?</p>