Posts Tagged ‘memory’

SIZE aligned memory allocation.

Most CPUs require that object and variables reside at paticular offsets in the systems memory. On most Unix systems, an attempt to use misaligned data results in a bus error, which terminates the program altogether. Most compilers automatically align data variables according to their type and the particular processor being used. And under the other circumstances, for example, DMA data transfer will also require the memory block is page-size aligned.

So how to allocate SIZE aligned memory chunk in your program ?


Read Full Post »