123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #include "private.h"
- void
- lub_heap_init_free_block(lub_heap_t * this,
- void *start,
- size_t size, bool_t seg_start, bool_t seg_end)
- {
- lub_heap_free_block_t *block = start;
- lub_heap_tag_t *tail;
- words_t words;
-
- lub_heap_taint_memory(start, LUB_HEAP_TAINT_FREE, size);
-
- words = (size >> 2);
-
- block->tag.segment = seg_start;
- block->tag.free = 1;
- block->tag.words = words;
-
- lub_bintree_node_init(&block->bt_node);
-
- tail = lub_heap_block__get_tail((lub_heap_block_t *) block);
- tail->segment = seg_end;
- tail->free = 1;
- tail->words = words;
-
- lub_bintree_insert(&this->free_tree, block);
- ++this->stats.free_blocks;
- this->stats.free_bytes += (words << 2);
- this->stats.free_bytes -= sizeof(lub_heap_alloc_block_t);
- this->stats.free_overhead += sizeof(lub_heap_alloc_block_t);
- }
|