![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <MemoryManager.h>


Public Member Functions | |
| 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 |
Public Member Functions inherited from cloudViewer::core::MemoryManagerDevice | |
| virtual | ~MemoryManagerDevice ()=default |
Static Public Member Functions | |
| static void | ReleaseCache (const Device &device) |
Frees all releasable memory blocks on device device. More... | |
| static void | ReleaseCache () |
Protected Attributes | |
| std::shared_ptr< MemoryManagerDevice > | device_mm_ |
Generic cached memory manager. This class can be used to speed-up memory allocations and deallocations from arbitrary direct memory managers.
ReleaseCache or automatically if a direct allocation fails after observing a cache miss. Definition at line 105 of file MemoryManager.h.
|
explicit |
Constructs a cached memory manager instance that wraps the existing direct memory manager device_mm.
Definition at line 474 of file MemoryManagerCached.cpp.
References device_mm_, and LogError.
|
overridevirtual |
Frees previously allocated memory at address ptr on device device.
Implements cloudViewer::core::MemoryManagerDevice.
Definition at line 492 of file MemoryManagerCached.cpp.
References cloudViewer::core::Cacher::Free(), and cloudViewer::core::Cacher::GetInstance().
|
overridevirtual |
Allocates memory of byte_size bytes on device device and returns a pointer to the beginning of the allocated memory block.
Implements cloudViewer::core::MemoryManagerDevice.
Definition at line 484 of file MemoryManagerCached.cpp.
References device_mm_, cloudViewer::core::Cacher::GetInstance(), and cloudViewer::core::Cacher::Malloc().
|
overridevirtual |
Copies num_bytes bytes of memory at address src_ptr on device src_device to address dst_ptr on device dst_device.
Implements cloudViewer::core::MemoryManagerDevice.
Definition at line 500 of file MemoryManagerCached.cpp.
References device_mm_.
|
static |
Frees all releasable memory blocks on all known devices. Note that this may also affect other instances of MemoryManagerCached.
Definition at line 512 of file MemoryManagerCached.cpp.
References cloudViewer::core::Cacher::Clear(), and cloudViewer::core::Cacher::GetInstance().
Referenced by cloudViewer::core::Free(), cloudViewer::core::Malloc(), and cloudViewer::core::cuda::ReleaseCache().
|
static |
Frees all releasable memory blocks on device device.
Definition at line 508 of file MemoryManagerCached.cpp.
References cloudViewer::core::Cacher::Clear(), and cloudViewer::core::Cacher::GetInstance().
|
protected |
Definition at line 136 of file MemoryManager.h.
Referenced by Malloc(), Memcpy(), and MemoryManagerCached().