8 #include "HeapMemory.hpp" 14 static const int extra_pad = 512;
39 #ifdef GARBAGE_INJECTOR 45 std::cerr << __FILE__ <<
":" << __LINE__ <<
" error memory already allocated\n";
109 std::cerr <<
"Error " << __LINE__ << __FILE__ <<
": source buffer is too big to copy";
126 const HeapMemory * ofpm = dynamic_cast<const HeapMemory *>(&m);
182 #ifdef GARBAGE_INJECTOR virtual size_t size() const =0
get the size of the buffer
virtual void fill(unsigned char c)
fill host and device memory with the selected byte
virtual bool allocate(size_t sz)
allocate memory
void setAlignment(size_t align)
Set alignment the memory will be aligned with this number.
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 size_t size() const
the the size of the allocated memory
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