commit b1f3273fb54e449e21fcba4f628fa1c37a0fff88
parent 394b187756d240ebbec6f1b57bb6423828fb5200
Author: Walther Chen <walther.chen@gmail.com>
Date: Thu, 24 Oct 2024 22:18:31 -0400
clump_finding fix temp alloc scope
For nested @pool, it's necessary to pass `allocator::temp()` to the pool
as an argument to start a new temp allocator scope. Otherwise memory you
want to use with the outer pool will be released by the inner pool.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util.c3 b/util.c3
@@ -30,7 +30,7 @@ fn String[] clump_finding(
HashMap(<String, char>) clumps; // a set
clumps.temp_init();
for (int i = 0; i <= genome.len - region_len; i += 1) {
- @pool() {
+ @pool(allocator::temp()) {
FrequencyTable freq_map = frequency_table(genome[i:region_len], k, allocator::temp());
freq_map.@each(; String kmer, int count) {
if (count >= clump_threshold) {