29 space_map_type::const_iterator cur =
free_space_.begin();
33 TLX_LOG1 <<
"Free chunk: begin: " << (cur->first) <<
" size: " << (cur->second);
36 TLX_LOG1 <<
"Total bytes: " << total;
40 uint64_t block_pos, uint64_t block_size,
41 const space_map_type::iterator& pred,
42 const space_map_type::iterator& succ)
const 44 TLX_LOG1 <<
"Error deallocating block at " << block_pos <<
" size " << block_size;
45 TLX_LOG1 << ((pred == succ) ?
"pred==succ" :
"pred!=succ");
47 TLX_LOG1 <<
"pred==free_space_.end()";
51 TLX_LOG1 <<
"pred==free_space_.begin()";
52 TLX_LOG1 <<
"pred: begin=" << pred->first <<
" size=" << pred->second;
55 TLX_LOG1 <<
"succ==free_space_.end()";
59 TLX_LOG1 <<
"succ==free_space_.begin()";
60 TLX_LOG1 <<
"succ: begin=" << succ->first <<
" size=" << succ->second;
67 TLX_LOG <<
"Deallocating a block with size: " << block_size <<
" position: " << block_pos;
68 uint64_t region_pos = block_pos;
69 uint64_t region_size = block_size;
82 if (pred->first <= region_pos && (pred->first + pred->second) > region_pos) {
85 "Error: double deallocation of external memory, trying to deallocate " 86 "region " << region_pos <<
" + " << region_size <<
" in empty space" 87 "[" << pred->first <<
" + " << pred->second <<
"]" 93 if (region_pos <= succ->first && (region_pos + region_size) > succ->first) {
96 "Error: double deallocation of external memory, trying to deallocate " 97 "region " << region_pos <<
" + " << region_size <<
" which overlaps empty space " 98 "[" << succ->first <<
" + " << succ->second <<
"]" 108 else if ((*pred).first + (*pred).second == region_pos) {
110 region_size += (*pred).second;
111 region_pos = (*pred).first;
118 const bool succ_is_not_the_first = (succ !=
free_space_.begin());
120 if ((*succ).first == region_pos + region_size) {
122 region_size += (*succ).second;
124 if (succ_is_not_the_first)
128 if (succ_is_not_the_first) {
133 else if ((*pred).first + (*pred).second == region_pos) {
135 region_size += (*pred).second;
136 region_pos = (*pred).first;
142 if ((*succ).first == region_pos + region_size) {
144 region_size += (*succ).second;
void add_free_region(uint64_t block_pos, uint64_t block_size)
#define FOXXLL_THROW2(exception_type, location, error_message)
Throws exception_type with "Error in [location] : [error_message]".
void deallocation_error(uint64_t block_pos, uint64_t block_size, const space_map_type::iterator &pred, const space_map_type::iterator &succ) const
space_map_type free_space_
map of free space as places
#define TLX_LOG
Default logging method: output if the local debug variable is true.