Hi Dimitri, Le 11/04/2018 à 12:28, Dimitri Vorona a écrit : > > I think, it comes down to the memory ownership. While Buffer apparently > never owns it's memory (based on the doc string), a MutableBuffer can. So > if you slice a MutableBuffer, and the memory gets deallocated, you've got > the same problem.
I may be misunderstanding, but that sounds unlikely. Can you post a concrete example? > Your proposed solution seems to be a safe one, we could even use > shared_ptr::use_counts. But I'd rather invert the responsibility: a parent > buffer can do with it's memory as it pleases, the slices get a way of > checking if they are still valid. That's inherently incorrect with multiple threads. I think we should step back a bit: what's the use case, and what's the minimal way to satisfy that use case without opening a whole can of worms? Regards Antoine.