title: Crash due to unaccessable memory in shared memory on Windows 10
body: <p>I created a shared memory using <code>CreateFileMapping</code> and get a view using <code>MapViewOfFile</code>:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>  HANDLE hMappedFile =
      CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, DWORD(nSharedMemorySize), L"some-file-identifier")
  
  void* lpViewOfData = MapViewOfFile(m_hMappedFile, FILE_MAP_ALL_ACCESS, 0, 0, 0);
  </code></pre>
  
  <p>Then I cast <code>lpViewOfData</code> to <code>unsigned  int *</code></p>
  
  <pre class="lang-cpp prettyprint-override"><code>unsigned int *address= reinterpret_cast&lt;unsigned int *&gt;(lpViewOfData)
  </code></pre>
  
  <p>when writing to the <code>address</code>, the process crashed</p>
  
  <pre class="lang-cpp prettyprint-override"><code>for(size_t i=0; i&lt;len; ++i){ // len is not out-of-rangle
      address[i] = i;
  }
  </code></pre>
  
  <p>I dumped the memory with windbg and get some <code>??</code> in the shared memory,which means unmapped address according to <a href="https://stackoverflow.com/a/3108668/5829527">?? in memory locations</a>.</p>
  
  <pre><code>000001c7`47bc0ff0  00000b18 00000b1a 00000c79 00000b1a
  000001c7`47bc1000  ???????? ???????? ???????? ????????
  ...// bad
  000001c7`47bc1ff0  ???????? ???????? ???????? ????????
  000001c7`47bc2000  00000000 00000000 d3304ef3 10f7808e
  ...
  ... // good
  ...
  000001c7`47c2eff0  47c2f000 000001c7 00000000 00000000
  000001c7`47c2f000  ???????? ???????? ???????? ????????
  ... // bad
  000001c7`47c2fff0  ???????? ???????? ???????? ????????
  000001c7`47c30000  00000000 00000000 c5305ef5 0101c17e
  </code></pre>
  
  <p>As showed above, these <code>??</code> regions are exactly <code>4k</code> bytes in length.</p>
  
  <p>I want know what's possible reasons to this problem, does this means hard disk error or wrong operations to these memory(other thread freed these region)?</p>