To allocate and release memory in your C API functions, the API provides utility methods, such as the sqlmr_alloc, sqlmr_release and other methods of Memory.h. In addition, many of the datatype objects such as String provide more specialized memory utility functions. See Data Types in the C API.