Skip to content

Commit 94c053c

Browse files
authored
coreml : wrap inference call in @autoreleasepool to fix memory leak (ggml-org#1218)
1 parent 758c1e3 commit 94c053c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

coreml/whisper-encoder.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ void whisper_coreml_encode(
5353
error: nil
5454
];
5555

56-
whisper_encoder_implOutput * outCoreML = [(__bridge id) ctx->data predictionFromLogmel_data:inMultiArray error:nil];
56+
@autoreleasepool {
57+
whisper_encoder_implOutput * outCoreML = [(__bridge id) ctx->data predictionFromLogmel_data:inMultiArray error:nil];
5758

58-
memcpy(out, outCoreML.output.dataPointer, outCoreML.output.count * sizeof(float));
59+
memcpy(out, outCoreML.output.dataPointer, outCoreML.output.count * sizeof(float));
60+
}
5961
}
6062

6163
#if __cplusplus

0 commit comments

Comments
 (0)