[...] Getty's allocation story during deserialization:
Deserialized pointer values returned by an access method (e.g., nextKey) will be freed upon failure and, where applicable1, upon success, if the value's corresponding isXAllocated method (e.g., isKeyAllocated) returns true.
Deserialized pointer values not returned by an access method will always be freed upon failure and, where applicable1, upon success.
Generally speaking, "where applicable" means whenever a deserialized value is not part of the final value returned to the end user. For instance, if a heap-allocated string is visited to produce an integer, the string isn't part of the final, returned integer and so we'd free it even upon success.
note to self: one place that references the allocation model is the doc comment for free.
From https://github.com/getty-zig/getty/issues/127#issuecomment-1666273887,
note to self: one place that references the allocation model is the doc comment for
free
.