diff options
| -rw-r--r-- | ttt.jai | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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); } |
