Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions
xgboost::common::MallocResource Class Reference
Inheritance diagram for xgboost::common::MallocResource:
xgboost::common::ResourceHandler

Public Member Functions

 MallocResource (std::size_t n_bytes)
 
void * Data () override
 
std::size_t Size () const override
 
template<bool force_malloc = false>
void Resize (std::size_t n_bytes, std::byte init=std::byte{0})
 Resize the resource to n_bytes.
 
- Public Member Functions inherited from xgboost::common::ResourceHandler
template<typename T >
T * DataAs ()
 
auto Type () const
 
 ResourceHandler (Kind kind)
 
 ResourceHandler (ResourceHandler const &that)=delete
 
ResourceHandleroperator= (ResourceHandler const &that)=delete
 
 ResourceHandler (ResourceHandler &&that)=delete
 
ResourceHandleroperator= (ResourceHandler &&that)=delete
 
bool IsSameType (ResourceHandler const &that) const
 Wether two resources have the same type.
 

Additional Inherited Members

- Public Types inherited from xgboost::common::ResourceHandler
enum  Kind : std::uint8_t { kMalloc = 0 , kMmap = 1 }
 

Member Function Documentation

◆ Data()

void * xgboost::common::MallocResource::Data ( )
inlineoverridevirtual

◆ Resize()

template<bool force_malloc = false>
void xgboost::common::MallocResource::Resize ( std::size_t  n_bytes,
std::byte  init = std::byte{0} 
)
inline

Resize the resource to n_bytes.

Unlike std::vector::resize, it prefers realloc over malloc.

Template Parameters
force_mallocForce the use of malloc over realloc. Used for testing.
Parameters
n_bytesThe new size.

◆ Size()

std::size_t xgboost::common::MallocResource::Size ( ) const
inlineoverridevirtual

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