Go to the documentation of this file.
17 using std::runtime_error;
24 chunksize(_csize), index(_csize), memsize(0), wastedspace(0)
29 for(
unsigned int i = 0; i <
mem.size(); i++) {
36 cout <<
"Alloc'd " <<
memsize/(1024*1024.0) <<
" Mb " << endl;
37 cout <<
" wasted " <<
wastedspace/(1024*1024.0) <<
" Mb " << endl;
52 chunk =
new unsigned char[size];
53 memset(chunk, 0, size);
61 chunk = chunk +
index;
70 chunksize(_csize), memsize(0)
75 for(
unsigned int i = 0; i <
mem.size(); i++) {
82 cout <<
"Alloc'd " <<
memsize/(1024*1024.0) <<
" Mb " << endl;
84 unsigned long int wastedspace = 0;
85 for(
unsigned int i = 0; i <
index.size(); i++) {
90 cout <<
"wasted " << wastedspace/(1024*1024.0) <<
" Mb " << endl;
96 for (
unsigned int i = 0; i <
index.size(); i++) {
100 chunk = chunk +
index[i];
111 chunk =
new unsigned char[size];
112 memset(chunk, 0, size);
115 mem.push_back(chunk);
116 index.push_back(size);
121 m_base_ptr(base_ptr), m_size(max_size), m_index(0)
129 cout <<
"Using " <<
m_index <<
" of " <<
m_size <<
" bytes." << endl;
135 throw runtime_error(
"SequentialAllocator memory overflow");
unsigned char * allocate(unsigned int size)
ChunkAllocator(unsigned int _csize=(1<< 20))
unsigned long int wastedspace
const unsigned int chunksize
unsigned long int memsize
PackedChunkAllocator(unsigned int _csize=(1<< 20))
SequentialAllocator(unsigned char *base_ptr, unsigned int max_size)
Handle a preallocated memory up to max_size.
unsigned char * m_base_ptr
unsigned char * allocate(unsigned int size)
std::vector< unsigned int > index
const unsigned int chunksize
unsigned char * allocate(unsigned int size)
allocator object that gets chunks of memory and then hands parts of them to a user
std::vector< unsigned char * > mem
unsigned long int memsize
std::vector< unsigned char * > mem
lvr2
Author(s): Thomas Wiemann
, Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:22