Question

If I use allocate_aligned to allocate a chunk of aligned memory in managed shared memory, is it guaranteed that this allocation will have the same alignment when shared in other processes ? The documentation makes it clear that the base address may be mapped differently, of course, but it doesn't seem to say anything about alignment.

I've run an experiment which seem to show that the alignment is the same, but that may just be down to luck and so I'd like to get a more reliable confirmation as to the expected behaviour. (Common sense says that it ought to be the same alignment, otherwise it would seriously limit the usefulness of allocate_aligned in shared memory, but I really need more than just an appeal to common sense.)

Was it helpful?

Solution

Yes, unless you need more than page alignment for some strange reason.

The base address may be mapped differently, but such mappings are done with page granularity. This implies 4K alignment on common architectures.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top