title: When the memory is actually allocated for new int[250000000] in C++?
body: <p>I'm trying to figure out when the memory is allocated for my program. Here is my code</p>
  <pre><code>#include &lt;unistd.h&gt;
  #include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  using namespace std;
  int main()
  {
    cout &lt;&lt; &quot;when the memory is allocated?&quot;;
    cout &lt;&lt; endl;
    cout.flush();
    int * p = new int[250000000];
    sleep(3);
    cout &lt;&lt; &quot;address: &quot; &lt;&lt; p;
    cout &lt;&lt; endl;
    cout.flush();
    sleep(3);
    cout &lt;&lt; &quot;value&quot; &lt;&lt; p[0];
    cout &lt;&lt; endl;
    cout.flush();
    sleep(10);
    cout &lt;&lt; &quot;ending&quot;;
    cout &lt;&lt; endl;
    return 0;
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/NHfNm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NHfNm.png" alt="enter image description here" /></a></p>
  <p>I kept track of it with Activity Monitor on my mac.</p>
  <p>I found I didn't get the GB memory I applied. When the memory will be actually allocated for <code>new int[250000000]</code> in C++?</p>