# Write a Dynamic Memory Allocator

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/cross-platform/dynamic-memory-allocator/)
- [Dynamic memory allocation](https://learn.arm.com/learning-paths/cross-platform/dynamic-memory-allocator/1_dynamic_memory_allocation/)
- [Design a dynamic memory allocator](https://learn.arm.com/learning-paths/cross-platform/dynamic-memory-allocator/2_designing_a_dynamic_memory_allocator/)
- [Implement a dynamic memory allocator](https://learn.arm.com/learning-paths/cross-platform/dynamic-memory-allocator/3_implementing_a_dynamic_memory_allocator/)
- [Memory allocation summary](https://learn.arm.com/learning-paths/cross-platform/dynamic-memory-allocator/4_conclusions_further_work/)
- [Next Steps](https://learn.arm.com/learning-paths/cross-platform/dynamic-memory-allocator/_next-steps/)

## About this Learning Path

|  |  |
| --- | --- |
| Skill level: | Introductory |
| Reading time: | 2 hrs |
| Last updated: | 02 Jul 2026 |

|  |  |
| --- | --- |
| Author: | David Spickett , Arm |
| Arm IP: | [Cortex-A](https://support.arm.com/?tab=compute-ip&Product%20Type=Application%20Processors) [Neoverse](https://support.arm.com/?tab=compute-ip&Product%20Type=Infrastructure%20Processors) |
| Tags: | [Performance and Architecture](https://learn.arm.com/tag/performance-and-architecture/) [Linux](https://learn.arm.com/tag/linux) [C](https://learn.arm.com/tag/c) [Runbook](https://learn.arm.com/tag/runbook) |

### Who is this for?
This is an introductory topic for software developers learning about dynamic memory allocation for the first time, and who may have used malloc and free in C programming. It also provides a starting point to explore more advanced memory allocation topics.

### What will you learn?
After completing this Learning Path, you'll be able to perform the following tasks:
- Explain how dynamic memory allocation and the C heap works
- Write a simple dynamic memory allocator
- Explain some of the risks of heap allocation in general

### Prerequisites
Before starting, you'll need the following prerequisites:
- Familiarity with C programming, with a good understanding of pointers.
- A Linux machine to run the example code.

### Summary
You’ll design and implement a minimal dynamic memory allocator in C on Linux, showing how heap-style allocation works behind familiar interfaces. First, you’ll define the behavior of `simple_malloc` and `simple_free`, implement them in a small project with `heap.c` and `heap.h`, and exercise them from a provided test program. Then, you’ll contrast dynamic and static allocation, describe failure behavior, and explore practical trade-offs of a simple allocator. You’ll build and run the code, observe allocations and frees in action, and reason about basic risks and limitations of heap usage when integrating allocation into real programs.
