title: Page aligned memory allocation in Linux C++
body: <p>Suppose, I need to allocate a large Vector in a Linux64 C++ app.
  I do the following:</p>
  
  <pre><code>int main()
  {
    std::vector&lt;int&gt; v;
    v.resize(2000);
  
    std::cout &lt;&lt; &amp;v[0] &lt;&lt; std::endl;
  
    return 0;
  }
  </code></pre>
  
  <p>This prints 0x7ffc2a177450 on my laptop, which is word-aligned. However, the Vector size is 2000*4B = 8kB, which is exactly 2 pages on my 4kB page Ubuntu system.</p>
  
  <p>Question: How can I put my Vector in the beginning of the page, such that allocation yields in exactly 2 pages in the physical memory? Ideally, both pages in the physical memory should also be continuous. Thank you!</p>