the win32.hlp says windows allocates memmory in chunks of 64K, I just ran a program that calls getsysinfo and the value returned in the dwAllocationGranularity member of a SYSTEM_INfo structure is 65536. While the dwPageSize member returned 4k

Which of these is most important if I wanted to use Memory mapping techniques on a files greater than 1Mbyte?

the Martial
Posted on 2001-08-08 15:59:25 by MArtial_Code
Hi !

Windows allocates with Virtual Alloc memory always on 64k-boundarys in multiple of 4k-blocks

so if you ask GetSysInfo then you will get a structure with the informations:

dwPageSize - that's the size of a standard memorypage on x86 systems (4k). also the virtual-memory-handler of windows exchanges always blocks which size are multiples of it.

dwAllocationGranularity - here you get the smallest memoryblock you can allocate, actually it's 64k so all allocated memory blocks
will align at 64k-boundarys

(but that's not the way heaps function ..!)

so for mapping files into memory choose multiples of 64k-blocks

Hope that will help you.

(If you have a well sorted library at your home, take a look at
"Advanced Wndows" by Jeffrey Richter, there you will get many informations about the memory-handling of windows)

Greetings, CALEB
Posted on 2001-08-08 18:39:01 by Caleb