Allocated storage duration
Allocated storage duration is the C storage duration of dynamically allocated storage, ending when it is deallocated, reallocated, or the program terminates.
Modern C
Allocated storage is a region of C storage obtained dynamically for use in representing objects during execution.
- How it is used
- Explains how execution-time storage supports data whose size or shape cannot be fixed conveniently in advance.
- How deep it goes
- Defines allocated duration, allocation functions, lifetime, and initialization, but defers broader declaration and linkage details to comparison material.
- Examples
- Uses a dynamically allocated rational number, a vector of doubles, and allocation helpers for initialized rational arrays.
- What you can do after
- Apply it via malloc-family functions, explicit initialization, and free while reasoning about object lifetime.
Modern C, Third Edition
Allocated storage duration is the duration of an object created by a dynamic allocation function and ended by deallocation, reallocation, or program termination.
- How it is used
- Explains how dynamically created objects begin, persist, and end during C program execution.
- How deep it goes
- Defines lifetime boundaries and initialization obligations, without developing allocator internals.
- Examples
- Uses malloc with rat_init and recommends calloc or type-specific initialization functions for allocated data.
- What you can do after
- Operate dynamically allocated objects by selecting an allocation function, initializing storage, and ending its duration correctly.
Read how Modern C, Third Edition explains allocated storage duration →
Related concepts
- mallocproduced by · malloc is a C standard-library function that allocates a specified number of bytes of uninitialized storage and returns a pointer to it or a null pointer if allocation fails.
- lifetimeuses · A lifetime is the interval during which a program entity exists and remains valid or accessible under the applicable language rules.
- storage durationkind of · Storage duration is the C property that determines how long an object exists during program execution and how its storage is managed.
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.

