FromFor some time now, I have searched and read a lot about memory alignment, how it workworks and how to use it. The most relevant article I have find for nowfound so far is this one.
But even with that I still have some questions about it:
- Out ofExcept in embedded system, we often have huge chunkchunks of memory in our computercomputers that make memory management a lot less criticcritical, I am completly into optimization, but now, is it really something that can make thea difference if we compare the same program with or without it's memory rearranged and aligned?
- IsDoes memory alignment have other advantages? I read somewhere that CPU work better/faster with aligned memory because that take it takes less instructions to process (if one of you have a link for an article/benchmark about it?), in that case, is the difference really significant? IsAre there more advantages than these two?
- In the article link, at chapter 5, the author say:
Beware: in C++, classes that look like structs may break this rule! (Whether they do or not depends on how base classes and virtual member functions are implemented, and varies by compiler.) 4. The article talk mostly about structures, but are local variables declaration is also affected by this need?
HaveDo you have any idea of how memory alignment workworks exactly in C++ since it seemseems to have some differences?
This former question contains the word "alignment", but it does not provide any answers to the questions above.