A memory resource wrapper that tracks allocation and deallocation statistics.
More...
|
| | TrackedMemoryResource (std::pmr::memory_resource *underlying, std::string_view name="") |
| | Constructs a new tracked memory resource.
|
| |
| std::string_view | name () const |
| | Gets the name of this tracked memory resource.
|
| |
|
| void * | do_allocate (std::size_t bytes, std::size_t alignment) override |
| | Allocates memory and updates tracking statistics.
|
| |
| void | do_deallocate (void *p, std::size_t bytes, std::size_t alignment) override |
| | Deallocates memory and updates tracking statistics.
|
| |
| bool | do_is_equal (const std::pmr::memory_resource &other) const noexcept override |
| | Checks if this memory resource is equal to another.
|
| |
A memory resource wrapper that tracks allocation and deallocation statistics.
This class wraps another memory resource and intercepts all allocation and deallocation calls to maintain global memory usage statistics.
◆ TrackedMemoryResource()
| Mila::Dnn::Compute::TrackedMemoryResource::TrackedMemoryResource |
( |
std::pmr::memory_resource * |
underlying, |
|
|
std::string_view |
name = "" |
|
) |
| |
|
inlineexplicit |
Constructs a new tracked memory resource.
- Parameters
-
| underlying | The memory resource to track. |
| name | Optional name for this memory resource for logging purposes. |
◆ do_allocate()
| void * Mila::Dnn::Compute::TrackedMemoryResource::do_allocate |
( |
std::size_t |
bytes, |
|
|
std::size_t |
alignment |
|
) |
| |
|
inlineoverrideprotected |
Allocates memory and updates tracking statistics.
◆ do_deallocate()
| void Mila::Dnn::Compute::TrackedMemoryResource::do_deallocate |
( |
void * |
p, |
|
|
std::size_t |
bytes, |
|
|
std::size_t |
alignment |
|
) |
| |
|
inlineoverrideprotected |
Deallocates memory and updates tracking statistics.
◆ do_is_equal()
| bool Mila::Dnn::Compute::TrackedMemoryResource::do_is_equal |
( |
const std::pmr::memory_resource & |
other | ) |
const |
|
inlineoverrideprotectednoexcept |
Checks if this memory resource is equal to another.
◆ name()
| std::string_view Mila::Dnn::Compute::TrackedMemoryResource::name |
( |
| ) |
const |
|
inline |
Gets the name of this tracked memory resource.
◆ name_
| std::string Mila::Dnn::Compute::TrackedMemoryResource::name_ |
|
private |
◆ underlying_
| std::pmr::memory_resource* Mila::Dnn::Compute::TrackedMemoryResource::underlying_ |
|
private |
The documentation for this class was generated from the following file: