apple / foundationdb

FoundationDB - the open source, distributed, transactional key-value store

Home Page:https://apple.github.io/foundationdb/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`fdb_future_get_key` & Memory Management

mkohlhaas opened this issue · comments

From the C API documentation for fdb_future_get_key

fdb_error_t fdb_future_get_key(FDBFuture *future, uint8_t const **out_key, int *out_key_length)

    Extracts a key from an FDBFuture into caller-provided 
variables of type uint8_t* (a pointer to the beginning of the key) and int (the length of the key). future must represent a result of 
the appropriate type (i.e. must have been returned by a function documented as returning this type), or the results are 
undefined.

    Returns zero if future is ready and not in an error state, and a non-zero error code otherwise (in which case the value of any out parameter is undefined).


> The memory referenced by the result is owned by the FDBFuture object and will be valid until either 
> fdb_future_destroy(future) or fdb_future_release_memory(future) is called.

Last paragraph:

The memory referenced by the result is owned by the FDBFuture object and will be valid until either
fdb_future_destroy(future) or fdb_future_release_memory(future) is called.

So foundationdb frees the memory I provide? Is this valid for every fdb_XXX or every fdb_future_get_XXX or just for fdb_future_get_key ?

Thank you in advance and for FoundationDB in general!