It is like HeapMemory but buffered. More...
It is like HeapMemory but buffered.
The concept of buffer is different from allocated memory. The buffer size can be <= the allocated memory
It differs from HeapMemory in resize behavior.
In the case of BHeapMemory if you try to shrink the memory nothing happen to the allocated memory. To destroy the internal memory you must use destroy.
BHeapMemory does not shrink the memory, but it shrink the buffer size. size() always return the buffer size
Definition at line 47 of file BHeapMemory.hpp.
#include <BHeapMemory.hpp>
Public Member Functions | |
BHeapMemory (const BHeapMemory &mem) | |
Copy the Heap memory. More... | |
BHeapMemory (BHeapMemory &&mem) noexcept | |
Copy the Heap memory. More... | |
BHeapMemory () | |
Constructor, we choose a default alignment of 32 for avx. | |
virtual | ~BHeapMemory () noexcept |
Destructor. | |
virtual bool | allocate (size_t sz) |
allocate the memory More... | |
virtual bool | resize (size_t sz) |
Resize the allocated memory. More... | |
virtual size_t | size () const |
Resize the buffer size. More... | |
size_t | msize () |
Return the memory size. More... | |
BHeapMemory & | operator= (const BHeapMemory &mem) |
Copy the memory. More... | |
BHeapMemory & | operator= (BHeapMemory &&mem) |
Copy the memory. More... | |
void | destroy () |
Destroy the internal memory. More... | |
void | swap (BHeapMemory &mem) |
swap the two mwmory object More... | |
![]() | |
virtual bool | flush () |
flush the memory | |
virtual bool | copy (const memory &m) |
copy memory More... | |
virtual void * | getPointer () |
get a readable pointer with the data More... | |
virtual const void * | getPointer () const |
get a readable pointer with the data More... | |
virtual void * | getDevicePointer () |
get a device pointer for HeapMemory getPointer and getDevicePointer are equivalents More... | |
virtual void | deviceToHost () |
Do nothing. | |
virtual void | incRef () |
Increment the reference counter. | |
virtual void | decRef () |
Decrement the reference counter. | |
virtual long int | ref () |
Return the reference counter. | |
bool | isInitialized () |
Allocated Memory is never initialized. More... | |
HeapMemory & | operator= (const HeapMemory &mem) |
HeapMemory (const HeapMemory &mem) | |
HeapMemory (HeapMemory &&mem) noexcept | |
HeapMemory () | |
Constructor, we choose a default alignment of 32 for avx. | |
void | swap (HeapMemory &mem) |
Swap the memory. More... | |
![]() | |
virtual | ~memory () |
destructor More... | |
Private Attributes | |
size_t | buf_sz |
size of the memory | |
|
inline |
|
inlinenoexcept |
|
inlinevirtual |
allocate the memory
Resize the allocated memory, if request is smaller than the allocated memory is not resized
sz | size |
Reimplemented from HeapMemory.
Definition at line 93 of file BHeapMemory.hpp.
|
inlinevirtual |
Destroy the internal memory.
Reimplemented from HeapMemory.
Definition at line 178 of file BHeapMemory.hpp.
|
inline |
Return the memory size.
Definition at line 139 of file BHeapMemory.hpp.
|
inline |
Copy the memory.
mem | memory to copy |
Definition at line 151 of file BHeapMemory.hpp.
|
inline |
Copy the memory.
mem | memory to copy |
Definition at line 166 of file BHeapMemory.hpp.
|
inlinevirtual |
Resize the allocated memory.
Resize the allocated memory, if request is smaller than the allocated memory is not resized
sz | size |
Reimplemented from HeapMemory.
Definition at line 112 of file BHeapMemory.hpp.
|
inlinevirtual |
Resize the buffer size.
Reimplemented from HeapMemory.
Definition at line 128 of file BHeapMemory.hpp.
|
inline |
swap the two mwmory object
mem | Memory to swap with |
Definition at line 189 of file BHeapMemory.hpp.