Swift & Concurrency (50 Qs)•Part 2: Concurrency, Actors & Advanced Architecture (11 - 24)
What is MemoryLayout<T> and how does Swift handle struct alignment and stride?
senior LevelSystem Design
In Simple Words:
- Size: Contiguous bytes of actual data stored.
- Alignment: Memory boundary required by CPU architecture (e.g. 8-byte boundary).
- Stride: Distance in bytes between successive elements in an array, including padding bytes required for alignment.