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

17.6 Reference counting

Function: Marpa_Value marpa_v_ref (Marpa_Value v)

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

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

Function: void marpa_v_unref ( Marpa_Value v)

Decreases the reference count by 1, destroying v once the reference count reaches zero. Beginning with v’s parent tree, 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.