Public Member Functions | Public Attributes | List of all members
rapidsmpf::LimitAvailableMemory Class Reference

A functor for querying the remaining available memory within a defined limit from an RMM statistics resource. More...

#include <buffer_resource.hpp>

Public Member Functions

 LimitAvailableMemory (RmmResourceAdaptor mr, std::int64_t limit)
 Constructs a LimitAvailableMemory instance. More...
 
std::int64_t operator() () const
 Returns the remaining available memory within the defined limit. More...
 

Public Attributes

std::int64_t const limit
 The memory limit.
 

Detailed Description

A functor for querying the remaining available memory within a defined limit from an RMM statistics resource.

This class is designed to be used as a callback to provide available memory information in the context of memory management, such as when working with BufferResource. The available memory is determined as the difference between a user-defined limit and the memory currently used, as reported by an RMM statistics resource adaptor.

By enforcing a limit, this functor can be used to simulate constrained memory environments or to prevent memory allocation beyond a specific threshold.

See also
rapidsmpf::BufferResource::MemoryAvailable

Definition at line 423 of file buffer_resource.hpp.

Constructor & Destructor Documentation

◆ LimitAvailableMemory()

rapidsmpf::LimitAvailableMemory::LimitAvailableMemory ( RmmResourceAdaptor  mr,
std::int64_t  limit 
)
inline

Constructs a LimitAvailableMemory instance.

Parameters
mrThe RMM resource adaptor.
limitThe maximum memory available (in bytes). Used to calculate the remaining memory.

Definition at line 432 of file buffer_resource.hpp.

Member Function Documentation

◆ operator()()

std::int64_t rapidsmpf::LimitAvailableMemory::operator() ( ) const
inline

Returns the remaining available memory within the defined limit.

This operator queries the RmmResourceAdaptor to determine the memory currently used and calculates the remaining memory as: limit - used_memory.

Returns
The remaining memory in bytes.

Definition at line 444 of file buffer_resource.hpp.


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