Here are macros that provide information on the current status of allocation in an obstack. You can use them to learn about an object while still growing it.
This macro returns the tentative address of the beginning of the currently growing object in obstack-ptr. If you finish the object immediately, it will have that address. If you make it larger first, it may outgrow the current chunk—then its address will change!
If no object is growing, this value says where the next object you allocate will start (once again assuming it fits in the current chunk).
This macro returns the address of the first free byte in the current
chunk of obstack obstack-ptr. This is the end of the currently
growing object. If no object is growing,
returns the same value as
This macro returns the size in bytes of the currently growing object. This is equivalent to
((size_t) (obstack_next_free (obstack-ptr) - obstack_base (obstack-ptr)))