The memory used to store data in the vector must be on adjacent addresses, since these addresses are visible in the code.
Typically, on most modern processors / operating systems, this means that the virtual addresses must be contiguous. If these virtual addresses cross the page boundary, then there is a good chance that the physical addresses will no longer be adjacent.
I must add that this is rarely a serious problem. In many cases, modern systems have at least some support for such fragmented memory usage down to the hardware level. For example, many network and disk controllers include a scatter / collect function, where the OS uses page tables to translate virtual addresses for a buffer to physical addresses, and then passes several physical addresses directly to the controller, which then collects data from these addresses if they are transferred from memory to peripheral or βscatterβ data to these addresses if they are transferred from the periphery to memory.
Jerry Coffin
source share