GNU Info

Info Node: (libc.info)Freeing Obstack Objects

(libc.info)Freeing Obstack Objects


Next: Obstack Functions Prev: Allocation in an Obstack Up: Obstacks
Enter node , (file) or (file)node

Freeing Objects in an Obstack
.............................

   To free an object allocated in an obstack, use the function
`obstack_free'.  Since the obstack is a stack of objects, freeing one
object automatically frees all other objects allocated more recently in
the same obstack.

 - Function: void obstack_free (struct obstack *OBSTACK-PTR, void
          *OBJECT)
     If OBJECT is a null pointer, everything allocated in the obstack
     is freed.  Otherwise, OBJECT must be the address of an object
     allocated in the obstack.  Then OBJECT is freed, along with
     everything allocated in OBSTACK since OBJECT.

   Note that if OBJECT is a null pointer, the result is an
uninitialized obstack.  To free all memory in an obstack but leave it
valid for further allocation, call `obstack_free' with the address of
the first object allocated on the obstack:

     obstack_free (obstack_ptr, first_object_allocated_ptr);

   Recall that the objects in an obstack are grouped into chunks.  When
all the objects in a chunk become free, the obstack library
automatically frees the chunk (Note: Preparing for Obstacks).  Then
other obstacks, or non-obstack allocation, can reuse the space of the
chunk.


automatically generated by info2www version 1.2.2.9