Next: Variable Size Automatic, Previous: Replacing malloc, Up: Memory Allocation [Contents][Index]
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.
• Creating Obstacks: | How to declare an obstack in your program. | |
• Preparing for Obstacks: | Preparations needed before you can use obstacks. | |
• Allocation in an Obstack: | Allocating objects in an obstack. | |
• Freeing Obstack Objects: | Freeing objects in an obstack. | |
• Obstack Functions: | The obstack functions are both functions and macros. | |
• Growing Objects: | Making an object bigger by stages. | |
• Extra Fast Growing: | Extra-high-efficiency (though more complicated) growing objects. | |
• Status of an Obstack: | Inquiries about the status of an obstack. | |
• Obstacks Data Alignment: | Controlling alignment of objects in obstacks. | |
• Obstack Chunks: | How obstacks obtain and release chunks; efficiency considerations. | |
• Summary of Obstacks: |
Next: Variable Size Automatic, Previous: Replacing malloc, Up: Memory Allocation [Contents][Index]