48 char* p = (
char*)
this + block_size() - 2;
65 void init(
size_t block_size) {
67 uint16_t len = block_size;
69 tag = (len & 0x7FFF) | (tag & 0x8000);
86 return !(tag & 0x8000);
95 memcpy(&left_tag, (
char*)
this - 2, 2);
101 ((
char*)
this + block_size());
105 return *((uint16_t*)((
char*)
this + block_size() - 2));
109 return *((uint16_t*)
this);
114 size_t index = needed / incr;
115 if (needed % incr != 0) {
150 void verify_block(
void*);
152 void verify_blocks();
157 size_t bufsize = 8192 * 10240,
170 #endif // __MEM_MGMT_H Definition: mem_mgmt.h:32
size_t _used
Definition: mem_mgmt.h:138
size_t _alloc
Definition: mem_mgmt.h:136
size_t _bufsize
Definition: mem_mgmt.h:126
const size_t _max
Definition: mem_mgmt.h:124
list_header_t ** _lists
Definition: mem_mgmt.h:128
size_t _last_non_empty
Definition: mem_mgmt.h:134
fixed_lists_mem_t(size_t bufsize=8192 *10240, size_t incr=32, size_t max=16384)
Definition: mem_mgmt.cpp:114
size_t _first_non_empty
Definition: mem_mgmt.h:132
slot_t(char *a, size_t l)
Definition: mem_mgmt.h:37
rc_t allocate(size_t length, slot_t &slot)
Definition: mem_mgmt.cpp:151
~fixed_lists_mem_t()
Definition: mem_mgmt.cpp:135
const T max(const T x, const T y)
Definition: w_minmax.h:45
const size_t _incr
Definition: mem_mgmt.h:122
Return code for most functions and methods.
Definition: w_rc.h:87
void add_to_list(size_t block_size, char *address)
Definition: mem_mgmt.cpp:22
char * address
Definition: mem_mgmt.h:33
char * remove_from_list(size_t block_size)
Definition: mem_mgmt.cpp:86
char * _buf
Definition: mem_mgmt.h:130
rc_t defrag()
Definition: mem_mgmt.cpp:258
rc_t free(slot_t slot)
Definition: mem_mgmt.cpp:211
size_t length
Definition: mem_mgmt.h:35
Definition: mem_mgmt.h:30
bool is_list_empty(size_t block_size)
Definition: mem_mgmt.cpp:106