Skip to content

Commit b760489

Browse files
Use tsi_blkalloc in matcher_indexes_t
Switch from tskit's tsk_blkalloc to tsinfer's tsi_blkalloc, which has an atomic total_size field for thread-safe memory observation. This makes matcher_indexes_t consistent with all other tsinfer structs.
1 parent 307073a commit b760489

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/ancestor_matcher.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ matcher_indexes_add_mutation(
10851085
int ret = 0;
10861086
mutation_list_node_t *list_node, *tail;
10871087

1088-
list_node = tsk_blkalloc_get(&self->allocator, sizeof(mutation_list_node_t));
1088+
list_node = tsi_blkalloc_get(&self->allocator, sizeof(mutation_list_node_t));
10891089
if (list_node == NULL) {
10901090
ret = TSI_ERR_NO_MEMORY;
10911091
goto out;
@@ -1174,7 +1174,7 @@ matcher_indexes_alloc(matcher_indexes_t *self, const tsk_table_collection_t *tab
11741174
ret = TSI_ERR_NO_MEMORY;
11751175
goto out;
11761176
}
1177-
ret = tsk_blkalloc_init(&self->allocator, 65536);
1177+
ret = tsi_blkalloc_init(&self->allocator, 65536);
11781178
if (ret != 0) {
11791179
goto out;
11801180
}
@@ -1199,7 +1199,7 @@ matcher_indexes_free(matcher_indexes_t *self)
11991199
tsk_safe_free(self->sites.mutations);
12001200
tsk_safe_free(self->sites.position);
12011201
tsk_safe_free(self->sites.num_alleles);
1202-
tsk_blkalloc_free(&self->allocator);
1202+
tsi_blkalloc_free(&self->allocator);
12031203
return 0;
12041204
}
12051205

lib/tsinfer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ typedef struct {
262262
} sites;
263263
edge_t *left_index_edges;
264264
edge_t *right_index_edges;
265-
tsk_blkalloc_t allocator;
265+
tsi_blkalloc_t allocator;
266266
} matcher_indexes_t;
267267

268268
typedef struct {

0 commit comments

Comments
 (0)