Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Just like in the title, what is a contiguous memory block?

question from:https://stackoverflow.com/questions/4059363/what-is-a-contiguous-memory-block

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
224 views
Welcome To Ask or Share your Answers For Others

1 Answer

This is a contiguous memory block of five bytes, spanning from location 1 to location 5:

alt text

It represents bytes (colored light blue) that are together in memory with no gap bytes (white) between them.

This is a non-contiguous set of five bytes of interest:

alt text

It is fragmented into three groups of bytes (colored yellow) with gap bytes at locations 4 and 6. Starting at location 1 there is a contiguous block of three bytes, spanning from locations 1 to 3. There are two more blocks of one byte each at locations 5 and 7, respectively.

The unused block at location 0 as well as any subsequent blocks beyond location 7 can usually be ignored since they do interpose between the bytes of interest spanning from locations 1 to 7.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...