Allocation Granularity and fragmentation
in Windows each process has its virtual address space to allocate dynamic memory.
To allocate a region of the virtual address space I use VirtualAlloc.
the size of allocated regions is always a multiple of the page size.
And every region I alloc starts on a 64k boundary...so every pointer returned by sequential calls to VirtualAlloc should be a multiple of 64 * 1024 (64k).
Let's say that in my system the page size is 4k and the allocation granularity is 64k.
I call VirtualAlloc to allocate 2 pages (8k). The pointer it returns is a multiple of 64k.
Then I call VirtualAlloc to allocate other 2 pages (on another region). The pointer is a multiple of 64k so it should be the pointer it returned in the first call + 64k. Right?
then I can't use the pages that aren't allocated from the first pointer to the second pointer?