summaryrefslogtreecommitdiffstats
path: root/src/heap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/heap.c')
-rw-r--r--src/heap.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/heap.c b/src/heap.c
index e93abe3..2473a70 100644
--- a/src/heap.c
+++ b/src/heap.c
@@ -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;