Learn

If memory is allocated contiguously (which is the case under segmentation) think about what will happen over time as more and more blocks of memory are allocated and freed.

At the beginning, our allocated memory is easily collapsed into contiguous blocks. But as we free some of those blocks and try to allocate new ones, the address space gets messy.

Because our operating system cannot anticipate the future needs of our processes, we begin to have smaller and smaller blocks of free memory. As a result, we may have 50 bytes of free memory in total, but if these are split across five blocks of 10 bytes, when we need room for a block of 20 bytes, it has nowhere to go.

As the size of these contiguous blocks of memory gets smaller, we say our memory is becoming more fragmented. Fragmentation is a main cause of memory inefficiency since fragmented memory stalls processes with large allocation needs.

In a later section, we discuss a memory management technique called paging which aims to solve the fragmentation problem and alleviate the inefficiencies it causes.

Instructions

Click Next when you’re ready to move on to the next exercise.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?