diff options
Diffstat (limited to 'src/heap.c')
-rw-r--r-- | src/heap.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -112,12 +112,16 @@ int __tf_heap_grow(struct tf_heap_head *head) { void *item; - if (head->allocated) + if (head->allocated) { + item = tf_bmem_resize(head->item, + head->allocated * sizeof(struct tf_heap_child), + 2 * head->allocated * sizeof(struct tf_heap_child)); head->allocated *= 2; - else - head->allocated = 128; + } else { + head->allocated = 4096 / sizeof(struct tf_heap_child); + item = tf_bmem_alloc(head->allocated * sizeof(struct tf_heap_child)); + } - item = realloc(head->item, head->allocated * sizeof(head->item[0])); if (item == NULL) return -ENOMEM; |