liveBook · Manning

Memory fragmentation

Memory fragmentation is the division of available memory into separated or inefficiently sized regions that reduce its effective usability or allocation efficiency.

How 3 Manning books explain it

High Performance Unity Game Development

Memory fragmentation is the condition in which available memory is divided into separated holes that may not accommodate a requested contiguous allocation.

How it is used
Identifies why repeated enemy GameObject creation and destruction can threaten smooth gameplay and later heap allocations.
How deep it goes
Works through contiguous-allocation failure with three arrays and explains Unity’s delayed reclamation and non-compacting garbage collector.
Examples
Uses three arrays with two 1 KB holes, plus repeatedly instantiated and destroyed enemy GameObjects.
What you can do after
Practice/perform it by grouping heap data by lifetime and reusing pooled GameObjects to limit gameplay allocation churn.

Read how High Performance Unity Game Development explains memory fragmentation →

Embedded Software with Rust

The division of free memory into separated regions that can make allocation requests harder to satisfy.

How it is used
Guides heap-allocation and allocator choices for firmware with constrained RAM and long uptimes.
How deep it goes
Connects allocation patterns to failure and reallocation, then offers mitigations without detailing allocator internals.
Examples
Contrasts Vec growth from zero to 100 elements with reserving capacity for 100 readings up front.
What you can do after
Apply Vec::with_capacity and profile allocator behavior before changing allocator implementations.

Read how Embedded Software with Rust explains memory fragmentation →

JavaScript in Depth

The condition in which usable memory is divided into separated free or occupied regions, reducing allocation or reclamation efficiency.

How it is used
Explains why garbage collectors and allocators trade memory efficiency against pause time and pointer-management complexity.
How deep it goes
Traces holes from object death through compaction or cell allocation, stopping short of allocation algorithms beyond the described mechanisms.
Examples
Uses V8 old-generation holes, compacted pages, and JSC blocks containing live objects among empty fixed-size cells.
What you can do after
Evaluate runtime memory behavior by relating scattered live objects to cache waste, allocation searches, compaction, and pause costs.

Read how JavaScript in Depth explains memory fragmentation →

Also covered in

What to know first

Related concepts

Questions about memory fragmentation

What is memory fragmentation?

Memory fragmentation is the division of available memory into separated or inefficiently sized regions that reduce its effective usability or allocation efficiency.

Which Manning books explain memory fragmentation?

High Performance Unity Game Development, Embedded Software with Rust and JavaScript in Depth.

What should I know before learning memory fragmentation?

Manning books that teach memory fragmentation usually introduce address space, Box, CPU and garbage collection first.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.