Exit Slides

Contiguous Memory

overview

Summary

Contiguous memory stores data in adjacent_addresses. In arrays, elements sit back to back, enabling constant_time_indexing and simple pointer_arithmetic. This layout improves spatial_locality, which is often more cache_friendly. However, growing such blocks can require moving data; expect resizing_costs. Allocating big contiguous blocks can increase memory_fragmentation. Compare with linked_lists, which use non-contiguous nodes and do not support O(1) indexing. Remember: contiguous_memory favors fast reads and predictable access patterns, but it trades flexibility in size.
← Prev Topic Slide 1 / 2