8 #include "HeapMemory.hpp"
14 static const int extra_pad = 512;
18 #include "Memleak_check.hpp"
33 std::cerr << __FILE__ <<
":" << __LINE__ <<
" error memory already allocated\n";
44 align(alignement,1,(
void *&)
dm,sz_a);
109 std::cerr <<
"Error " << __LINE__ << __FILE__ <<
": source buffer is too big to copy";
115 check_valid(m.
dm,
sz);
187 check_new(tdmOrig,sz+
alignement,HEAPMEMORY_EVENT,0);
195 align(alignement,1,(
void *&)tdm,sz_a);
virtual size_t size() const =0
get the size of the buffer
virtual bool allocate(size_t sz)
allocate memory
void setAlignment(size_t align)
Set alignment the memory will be aligned with this number.
virtual size_t size() const
the the size of the allocated memory
This class allocate, and destroy CPU memory.
size_t alignement
memory alignment
virtual void * getPointer()
get a readable pointer with the data
virtual void destroy()
destroy memory
byte * dmOrig
original pointer (before alignment)
virtual void * getDevicePointer()
get a device pointer for HeapMemory getPointer and getDevicePointer are equivalents ...
virtual bool resize(size_t sz)
resize the memory allocated
bool copyFromPointer(const void *ptr, size_t sz)
copy from Pointer to Heap
virtual bool copy(const memory &m)
copy memory
size_t sz
Size of the memory.
bool copyDeviceToDevice(const HeapMemory &m)
copy from same Heap to Heap
virtual void * getPointer()=0
return a data pointer