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 <resource.hpp>

Public Member Functions

constexpr LimitAvailableMemory (RmmResourceAdaptor const *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 452 of file resource.hpp.

Constructor & Destructor Documentation

◆ LimitAvailableMemory()

constexpr rapidsmpf::LimitAvailableMemory::LimitAvailableMemory ( RmmResourceAdaptor const *  mr,
std::int64_t  limit 
)
inlineconstexpr

Constructs a LimitAvailableMemory instance.

Parameters
mrA pointer to an RMM resource adaptor. The underlying resource adaptor must outlive this instance.
limitThe maximum memory available (in bytes). Used to calculate the remaining memory.

Definition at line 462 of file 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 474 of file resource.hpp.


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