Next: , Previous: , Up: Tree methods   [Contents]

16.3 Reference counting

Function: Marpa_Tree marpa_t_ref (Marpa_Tree t)

Increases the reference count by 1. Not needed by most applications.

Return value: On success, t. On failure, NULL.

Function: void marpa_t_unref (Marpa_Tree t)

Decreases the reference count by 1, destroying t once the reference count reaches zero. Beginning with t’s parent ordering, Libmarpa then proceeds up the chain of parent objects. Every time a child is destroyed, the reference count of its parent is decreased by 1. Every time the reference count of an object is decreased by 1, if that reference count is now zero, that object is destroyed. Libmarpa follows this chain of decrements and destructions as required, all the way back to the base grammar, if necessary.