What Is Internal Fragmentation?

October 23, 2023

Internal fragmentation is a memory issue that occurs when the allocator leaves extra space empty inside an allocated memory block. For example, let's say an allocator can only provide memory in chunks of 4 bytes. If a program requests 29 bytes of memory, it will actually receive a chunk of 32 bytes. Since the program uses only 29 of the 32 available bytes, the excess 3 bytes of memory goes to waste.

Over time, tiny chunks of unused memory build up and create large amounts of memory the allocator cannot put to use. The two most effective ways to prevent internal fragmentation are to allocate memory dynamically or to use partitions of different sizes.

Anastazija is an experienced content writer with knowledge and passion for cloud computing, information technology, and online security. At phoenixNAP, she focuses on answering burning questions about ensuring data robustness and security for all participants in the digital landscape.