Skip to content

Commit d09770c

Browse files
authored
ggml-alloc : fix list of allocated tensors with GGML_ALLOCATOR_DEBUG (#9573)
1 parent 41f4778 commit d09770c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ggml/src/ggml-alloc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,12 @@ static void ggml_dyn_tallocr_reset(struct ggml_dyn_tallocr * alloc) {
294294
alloc->free_blocks[0].offset = 0;
295295
alloc->free_blocks[0].size = SIZE_MAX/2; // restrict maximum size of a measure allocator to half size_t max to avoid overflows
296296
alloc->max_size = 0;
297+
298+
#ifdef GGML_ALLOCATOR_DEBUG
299+
for (int i = 0; i < 1024; i++) {
300+
alloc->allocated_tensors[i].tensor = NULL;
301+
}
302+
#endif
297303
}
298304

299305
static struct ggml_dyn_tallocr * ggml_dyn_tallocr_new(size_t alignment) {

0 commit comments

Comments
 (0)