title: windows memory management: Difference between VirtualAlloc() and heap functions
body: <p>I am reading windows memory management. In that I read about VirtualAlloc() and heap functions. I understood both the concepts. But when I started to compare them, then I got confused.</p>
  
  <p>I searched online about these concepts, I found lot of answers. But after reading them I still got confused. So to clarify my doubt I am asking few questions. You may feel these questions are duplicate.</p>
  
  <p>1)  When we call VirtualAlloc(),  from where we get memory form?  OR If we get memory from HeapAlloc(), is called as heap memory, If we get memory form VirtualAlloc(),  is called as?</p>
  
  <p>2)  If memory we get from VirtualAlloc() and HeapAlloc() are from Virtual Address or if there is no difference b/n the memory then why do we need them.</p>
  
  <p>3)  I read that, if we want to allocate big chunk of memory(100MB) then we need to call VirtualAlloc(). What happens if I use HeapAlloc() to allocate big chunk of memory(100 MB). If it works fine then why do we need virtualAlloc(). </p>
  
  <p>4)  I read that malloc() and new operator internally call HeapAlloc() for samller object and VirtualAlloc() for larger object. My question : In Windows to allocate memory form user mode do we have only these 2 API (virtualAlloc and HeapAlloc()).</p>
  
  <p>5)  In visual studio setting -> Linker -> system -> Heap Reserve size is 1MB. Is this is same same as default heap of the process.</p>
  
  <p>Please help me to understand these concepts. If you know any good link or good book  about this concept.</p>