[Orc] Actually save the callback
The callback function was captured by reference but it lived on the
stack and was in danger of being overwritten and could cause a crash.
[Orc] Only unmap shared memory in controller process destructor
By the time SharedMemoryMapper destructor is called, the RPC
connection is no longer available causing the release() call to
always fail. Instead at this point only shared memory regions
can be unmapped safely.
Deinitializers are called and mapped memory is released at the
executor side by ExecutorSharedMemoryMapperService::shutdown()
instead. Memory can also be released earlier by calling release()
earlier before RPC connection is closed.
[Orc] Provide correct Reservation address for slab allocations
When slab allocator is used, the MappingBase is not necessarily
the same as the original reservation base as the allocation could
be a part of the whole reservation.
In this case the original reservation address needs to be passed to
ExecutorSharedMemoryMapperService to associate the new allocation
with the original reservation.
[Orc] Improve deintialize and shutdown logic
When deinitializing, the allocation needs to be removed from the
allocation list of its associated reservation so that remaining
allocations can be deinitialized when releasing the reservation.
No braces needed for single lines. You could sink the definition of ReservationAddrs down below the if test too: