What is Memory Alignment?

Showing Answers 1 - 6 of 6 Answers

Memory alignment is the restriction imposed on memory allocation in such a way that values associated with multibyte get assigned only at certain places of memory. Such Memory alignment though generally not very common issue in OOPS terminology as the compiler takes care of allocation of bytes at proper locations.

  Was this answer useful?  Yes

stylonurus

  • Jan 9th, 2011
 

One way to align global or static variables is to use the __align qualifier.

I got this example from an IBM Linux Compiler site.
I think aligning data may be compiler dependant. In this example the global
variable var A is aligned on a 1024-byte boundary.

int __align(1024) varA;
main() and padded with 1020 bytes */ {...}

This static variable is aligned on a 512-byte boundary
static int __align(512) varB;


  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions