std.experimental.allocator

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sun Aug 13 16:00:51 UTC 2023


Yeah you're right Ternary should probably be replaced, although 
amazingly it has never caused problems so far.

But I cannot agree about RAII. Its a valid tool for managing lifetimes 
of memory allocators. Memory allocators must be able to store per 
instance state and that state must not accidentally die on you. If it 
does that is a great way to give the user a very bad day.

We are certainly aiming for different things, for instance I don't trust 
my (future) users when it comes to memory safety. So they get very well 
hand held in all aspects. Including locking of RCAllocator internally 
and using RC there.

But internally to API's if you need to optimize you'd use the composable 
allocator structs directly, rather than the expensive (in comparison) 
RCAllocator.



More information about the Digitalmars-d-learn mailing list