What is the difference between them (except that VirtualAlloc rounds to page boundaries). Why use VirtualAlloc if HeapAlloc can do the job?
Also, please help me with this: Virtual memory = Physical Memory + Swap Page File (right?).. Is HeapAlloc allocating in the Swap File if there is not enough Physical memory, or does it report an Out of Memory error because there is not enough physical memory? Thanks. :toothy
I moved this posting to the workshop so that you will get more answers. The MASM32 forum is for MASM32 specific postings.
I'm not an expert, but VirtualAlloc is a lowerlevel memory management function, HeapAlloc would be higher level. Basically use HeapAlloc unless you're reserving very large blocks of memory or need the extra control VirtualAlloc provides.
There is some good info on memory management here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/memory_management.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/memory_management.asp)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngenlib/html/heap3.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngenlib/html/heap3.asp)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngenlib/html/msdn_heapmm.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngenlib/html/msdn_heapmm.asp)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngenlib/html/msdn_manamemo.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngenlib/html/msdn_manamemo.asp)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngenlib/html/msdn_virtmm.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngenlib/html/msdn_virtmm.asp)