www.delorie.com/gnu/docs/glibc/libc_42.html   search  
 
Buy the book!


The GNU C Library

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2.4 Obstacks

An obstack is a pool of memory containing a stack of objects. You can create any number of separate obstacks, and then allocate objects in specified obstacks. Within each obstack, the last object allocated must always be the first one freed, but distinct obstacks are independent of each other.

Aside from this one constraint of order of freeing, obstacks are totally general: an obstack can contain any number of objects of any size. They are implemented with macros, so allocation is usually very fast as long as the objects are usually small. And the only space overhead per object is the padding needed to start each object on a suitable boundary.

3.2.4.1 Creating Obstacks  How to declare an obstack in your program.
3.2.4.2 Preparing for Using Obstacks  Preparations needed before you can use obstacks.
3.2.4.3 Allocation in an Obstack  Allocating objects in an obstack.
3.2.4.4 Freeing Objects in an Obstack  Freeing objects in an obstack.
3.2.4.5 Obstack Functions and Macros  The obstack functions are both functions and macros.
3.2.4.6 Growing Objects  Making an object bigger by stages.
3.2.4.7 Extra Fast Growing Objects  Extra-high-efficiency (though more complicated) growing objects.
3.2.4.8 Status of an Obstack  Inquiries about the status of an obstack.
3.2.4.9 Alignment of Data in Obstacks  Controlling alignment of objects in obstacks.
3.2.4.10 Obstack Chunks  How obstacks obtain and release chunks; efficiency considerations.
3.2.4.11 Summary of Obstack Functions  


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003