Re:Rust: Dropping heavy things in another thread can make yo...
by MaxBarraclough on Sunday May 31, 2020 @02:18PM
(#23371420)
Interesting, thanks. Seems to require use of a common base class though, i.e. to use a class with this pool, you have to inherit from Destructable, or else create a subclass that does. Seems ugly. Perhaps that's the only way it can be done in C++ though.
Re:Rust: Dropping heavy things in another thread can make yo...
by projektfu on Monday June 01, 2020 @03:45PM
(#23382873)
It does create an object with that base class for the allocator but returns an object of the type you want from the allocator, using a template (Region::Instance<T>). So the API user only sees the types it's interested in.
TR::Region is the slab allocator used by the JIT in OpenJ9/OMR. The linked commit adds functionality for calling destructors of arbitrary types allocated in the Region.