c++ - mmap: enforce 64K alignment -
i'm porting project written (by me) windows mobile platforms. i need equivalent of virtualalloc (+friends), , natural 1 mmap . there 2 significant differences. addresses returned virtualalloc guaranteed multiples of so-called allocation granularity ( dwallocationgranularity ). not confused page size, number arbitrary, , on windows system 64k. in contrast address returned mmap guaranteed page-aligned. the reserved/allocated region may freed @ once call virtualfree , , there's no need pass allocation size (that is, size used in virtualalloc ). in contrast munmap should given exact region size unmapped, i.e. frees given number of memory pages without relation how allocated. this imposes problems me. while live (2), (1) real problem. don't want details, assuming smaller allocation granularity, such 4k, lead serious efficiency degradation. related fact code needs put information @ every granularity boundary within allocated regions, impose "gaps" with