MemBlock Constructor and Destructor
Description
Constructs or destructs an object of class MemBlock.
Prototype
MemBlock(Allocator &allocator, void *addr, size_t block_size)
: allocator_(allocator), addr_(addr), count_(1U), block_size_(block_size) {}
virtual ~MemBlock() = default;
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
allocator |
Input |
Reference to class derived by a user from Allocator. |
addr |
Input |
Device memory address. |
block_size |
Input |
Size of the device memory address. |
Returns
A MemBlock object.
Exception Handling
None
Restrictions
After users inherit Allocator, the pointer of the MemBlock type needs to be returned when memory is allocated. Users only need to construct the MemBlock object based on the constructor. The destructor can be customized based on user requirements to avoid memory leakage.
Parent topic: MemBlock