I’d like to know how best to treat memory that I’m using for mapped buffer data after I’ve unmapped the buffer. For instance:
float* my_data; rtBufferMap(my_buffer, (void**)&my_data); rtBufferUnmap(my_buffer); do_stuff_with(my_data); free(my_data); // <== Should I do this?
If I’m going to call the above code frequently, then I’d like to avoid memory leaks from repeatedly mapping the buffer to new memory. However, sometime when I try to free the memory, I get an error that the pointer is not a valid heap pointer. What’s the best practice here? Does rtBufferMap malloc the memory for my_data internally, or is something completely different at work here?