|
| | MemoryManagerCached (const std::shared_ptr< MemoryManagerDevice > &device_mm) |
| |
| void * | Malloc (size_t byte_size, const Device &device) override |
| |
| void | Free (void *ptr, const Device &device) override |
| | Frees previously allocated memory at address ptr on device device. More...
|
| |
| void | Memcpy (void *dst_ptr, const Device &dst_device, const void *src_ptr, const Device &src_device, size_t num_bytes) override |
| |
| virtual | ~MemoryManagerDevice ()=default |
| |
| virtual void * | Malloc (size_t byte_size, const Device &device)=0 |
| |
| virtual void | Free (void *ptr, const Device &device)=0 |
| | Frees previously allocated memory at address ptr on device device. More...
|
| |
| virtual void | Memcpy (void *dst_ptr, const Device &dst_device, const void *src_ptr, const Device &src_device, size_t num_bytes)=0 |
| |
Generic cached memory manager. This class can be used to speed-up memory allocations and deallocations from arbitrary direct memory managers.
- Successful queries, i.e. cache hits, will result in constant-time allocations, but small direct allocations might still be faster.
- Failed queries, i.e. cache misses, will result in direct allocations.
- Direct frees will be delayed until either the end of the program or a cache release is triggered.
- (Partial) cache releases will be triggered either manually by calling
ReleaseCache or automatically if a direct allocation fails after observing a cache miss.