ReconstructMe SDK  2.6.43-0
Real-time 3D reconstruction engine
Memory Management and Thread Safety

Memory Management Rules and Thread Safety

This page familiarizes you with principal management rules and thread safety of the ReconstructMe API.

Memory Management Rules

The lifetime of pointers provided by the ReconstructMe SDK or to the ReconstructMe SDK is subject to the following rules

  • in-parameters must be allocated and freed by the caller.
  • out- and ref-parameters must not allocated or freed by the caller.
  • Unless otherwise stated the life-time of an out- or ref-parameter ends when a new ReconstructMe API function is called.

The following snippet shows the above rules applied to out- and ref-parameters.

const char *version_str;
int length;
reme_context_get_version(c, &version_str, &length);
printf("Version running: %s", version_str);
// You must not free/delete version_str

The following snippet shows the above rules applied to in-parameters.

float *mat = (float*)malloc(16 * sizeof(float));
// You are responsible for freeing/deleting in parameters
free(mat);

Thread Safety

In general each instance of a reme_context_t object has to be called by a single thread.