From 8df31fd16d001d2f321eba39eb52d657a57396c1 Mon Sep 17 00:00:00 2001 From: dam Date: Mon, 31 Jul 2023 09:06:54 +0100 Subject: WIP : Added notes to fix delete_task. --- ttt.jai | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ttt.jai b/ttt.jai index a35ac48..b210129 100644 --- a/ttt.jai +++ b/ttt.jai @@ -360,11 +360,14 @@ delete_task :: (using db: *Database, index: s64) -> bool { // TODO Maybe use `us } // Try to shrink database capacity if using more than 2MB. - // TODO WIP WIP WIP + TODO WIP WIP WIP Coalescing is failing because of this... + // if (tasks.allocated >> 2) > tasks.count && tasks.allocated * SIZE_OF_TASK > 2_000_000 { + print("> A <"); new_capacity := tasks.allocated >> 1; msg := tprint("shrinking from % to %\n", tasks.allocated, new_capacity); print_error(msg); + // if !tasks.allocator.proc remember_allocators(*tasks); new_tasks_data := realloc(tasks.data, new_capacity * SIZE_OF_TASK, tasks.allocated * SIZE_OF_TASK, tasks.allocator); if new_tasks_data != null { msg = tprint("OH NOEWS"); @@ -374,6 +377,7 @@ delete_task :: (using db: *Database, index: s64) -> bool { // TODO Maybe use `us } msg = tprint("ALL OK"); print_error(msg); + print("> B <"); } return true; @@ -1695,7 +1699,7 @@ main :: () { while tasks_to_process > 0 { task := *db.tasks[idx]; for < i : db.tasks.count-1..idx+1 { - if compare_strings(xx task.name, xx db.tasks[i].name) == 0 { + if compare_strings(xx task.name, xx db.tasks[i].name) == 0 { for item, index: db.tasks[i].times { task.times[index] = add(task.times[index], item); } -- cgit v1.2.3