title: Why does VirtualAlloc fail for 2GB even when running as 64bit process?
body: <p>This runs fine</p>
  
  <pre><code>    int GB = 2;
      int bytes = GB * 1024 * 1024 * 1024;
  
      LPVOID memory = VirtualAlloc(
          0,
          bytes-1, // 2GB - 1
          MEM_COMMIT,
          PAGE_READWRITE);
  </code></pre>
  
  <p>while here, as soon as I reach 2GB, it fails</p>
  
  <pre><code>    int GB = 2;
      int bytes = GB * 1024 * 1024 * 1024;
  
      LPVOID memory = VirtualAlloc(
          0,
          bytes, // 2GB
          MEM_COMMIT,
          PAGE_READWRITE);
  </code></pre>
  
  <p>with Windows error message "The parameter is incorrect". Why is this the case? Actually I would like to allocate even much more virtual memory.</p>