Allocating aligned memory blocks?

safety0ff via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Dec 11 23:02:23 PST 2014


On Friday, 12 December 2014 at 06:17:56 UTC, H. S. Teoh via 
Digitalmars-d-learn wrote:
>
> Is there a way to allocate GC
> memory blocks in D that are guaranteed to fall on OS page 
> boundaries?

I don't know about guarantees, I think that in practice, if your 
OS page size is 4096, any GC allocation of 4096 or greater will 
be page aligned.

> should I just forget the GC and just use posix_memalign() 
> manually?

I think it may be possible to do what you want with mmap/munmap 
alone (selectively map parts of the file to memory.)


More information about the Digitalmars-d-learn mailing list