Scroll to navigation

libtalloc_tutorial(3) Library Functions Manual libtalloc_tutorial(3)


libtalloc_tutorial - The Tutorial


Talloc is a hierarchical, reference counted memory pool system with destructors. It is built atop the C standard library and it defines a set of utility functions that altogether simplifies allocation and deallocation of data, especially for complex structures that contain many dynamically allocated elements such as strings and arrays.

The main goals of this library are: removing the needs for creating a cleanup function for every complex structure, providing a logical organization of allocated memory blocks and reducing the likelihood of creating memory leaks in long-running applications. All of this is achieved by allocating memory in a hierarchical structure of talloc contexts such that deallocating one context recursively frees all of its descendants as well.

Main features

  • An open source project
  • A hierarchical memory model
  • Natural projection of data structures into the memory space
  • Simplifies memory management of large data structures
  • Automatic execution of a destructor before the memory is freed
  • Simulates a dynamic type system
  • Implements a transparent memory pool

Table of contents:

Chapter 1: Talloc context

Chapter 2: Stealing a context

Chapter 3: Dynamic type system

Chapter 4: Using destructors

Chapter 5: Memory pools

Chapter 6: Debugging

Chapter 7: Best practises

Chapter 8: Using threads with talloc

Version 2.0 talloc