google / marl

A hybrid thread / fiber task scheduler written in C++ 11
Apache License 2.0
1.87k stars 193 forks source link

Ensure that all heap allocations use the marl::Allocator #131

Open ben-clayton opened 4 years ago

ben-clayton commented 4 years ago

marl::Allocator is the user-implementable interface that should be used for all marl heap allocations.

At the time of writing there are many places where we use std containers with the default allocator, which is clearly bypassing the marl::Allocator.

We should ensure that all allocations go through the provided marl::Allocator.

benvanik commented 4 years ago

RE shared_ptr; this may be useful: https://github.com/google/iree/blob/main/iree/base/ref_ptr.h (thread-safe intrusive pointer with support for type-specific custom deleters to make pooling easier)

AWoloszyn commented 1 year ago

This pull request also replaces std::function with std::packaged_task. std::packaged_task can take an allocator which will help with some of this as well. https://github.com/google/marl/pull/216