Hello Roger,
my thought was, if you allocated buffer properly via NewMem (or one of its siblings), then you should be able to use it directly. But as Cinema 4D will do an internal copy and destroy the passed buffer, you'd need to do something like this (pseudocode):
SetMemory(buffer)
buffer = GetMemory() // to get the pointer to the buffer owned by Cinema
// ... and then in the end, if you need to free the memory yourself and can't rely on the memory being destroyed on destruction of the BaseContainer
buffer = GetMemoryAndRelease()
Free(buffer)
Just thinking and probably you have thought of this option anyway.
Cheers,
Andreas