Open3D (C++ API)  0.19.0
Loading...
Searching...
No Matches
open3d::core::MemoryManagerCached Class Reference

#include <MemoryManager.h>

Inheritance diagram for open3d::core::MemoryManagerCached:
open3d::core::MemoryManagerDevice

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.
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 open3d::core::MemoryManagerDevice
virtual ~MemoryManagerDevice ()=default

Static Public Member Functions

static void ReleaseCache (const Device &device)
 Frees all releasable memory blocks on device device.
static void ReleaseCache ()

Protected Attributes

std::shared_ptr< MemoryManagerDevicedevice_mm_

Detailed Description

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.

Constructor & Destructor Documentation

◆ MemoryManagerCached()

open3d::core::MemoryManagerCached::MemoryManagerCached ( const std::shared_ptr< MemoryManagerDevice > & device_mm)
explicit

Constructs a cached memory manager instance that wraps the existing direct memory manager device_mm.

Member Function Documentation

◆ Free()

void open3d::core::MemoryManagerCached::Free ( void * ptr,
const Device & device )
overridevirtual

Frees previously allocated memory at address ptr on device device.

Implements open3d::core::MemoryManagerDevice.

◆ Malloc()

void * open3d::core::MemoryManagerCached::Malloc ( size_t byte_size,
const Device & device )
overridevirtual

Allocates memory of byte_size bytes on device device and returns a pointer to the beginning of the allocated memory block.

Implements open3d::core::MemoryManagerDevice.

◆ Memcpy()

void open3d::core::MemoryManagerCached::Memcpy ( void * dst_ptr,
const Device & dst_device,
const void * src_ptr,
const Device & src_device,
size_t num_bytes )
overridevirtual

Copies num_bytes bytes of memory at address src_ptr on device src_device to address dst_ptr on device dst_device.

Implements open3d::core::MemoryManagerDevice.

◆ ReleaseCache() [1/2]

void open3d::core::MemoryManagerCached::ReleaseCache ( )
static

Frees all releasable memory blocks on all known devices. Note that this may also affect other instances of MemoryManagerCached.

◆ ReleaseCache() [2/2]

void open3d::core::MemoryManagerCached::ReleaseCache ( const Device & device)
static

Frees all releasable memory blocks on device device.

Field Documentation

◆ device_mm_

std::shared_ptr<MemoryManagerDevice> open3d::core::MemoryManagerCached::device_mm_
protected

The documentation for this class was generated from the following files: