Function ecal_free_mem

Function Documentation

ECAL_API void ecal_free_mem(void *mem_)

Free an eCAL memory block allocated by functions like mon_get_monitoring, mon_get_logging, sub_receive, that let eCAL allocate the memory internally.

// let eCAL allocate memory for the subscriber buffer and return the pointer to 'rcv_buf'
const char* rcv_buf     = nullptr;
int         rcv_buf_len = 0;
long long   rcv_time    = 0;
int         timeout     = 0;
int ret = sub_receive(subscriber_handle, &rcv_buf, &rcv_buf_len, &rcv_time, timeout);
if(rcv_buf_len > 0)
{
  ...
  // PROCESS THE BUFFER CONTENT HERE
  ...
  // finally free the allocated memory
  ecal_free_mem((void*)rcv_buf);
}