8#include "HeapMemory.hpp"
14static 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";
182 #ifdef GARBAGE_INJECTOR
This class allocate, and destroy CPU memory.
virtual bool allocate(size_t sz)
allocate memory
bool copyFromPointer(const void *ptr, size_t sz)
copy from Pointer to Heap
byte * dmOrig
original pointer (before alignment)
void setAlignment(size_t align)
Set alignment the memory will be aligned with this number.
virtual void fill(unsigned char c)
fill host and device memory with the selected byte
virtual bool resize(size_t sz)
resize the memory allocated
virtual void * getPointer()
get a readable pointer with the data
virtual size_t size() const
the the size of the allocated memory
virtual bool copy(const memory &m)
copy memory
size_t alignement
memory alignment
size_t sz
Size of the memory.
virtual void * getDevicePointer()
get a device pointer for HeapMemory getPointer and getDevicePointer are equivalents
virtual void destroy()
destroy memory
bool copyDeviceToDevice(const HeapMemory &m)
copy from same Heap to Heap
virtual void * getPointer()=0
return a data pointer
virtual size_t size() const =0
get the size of the buffer