Skip to content

Commit

Permalink
coreml : wrap inference call in @autoreleasepool to fix memory leak (g…
Browse files Browse the repository at this point in the history
  • Loading branch information
denersc committed Aug 29, 2023
1 parent 87b88a4 commit 89c66bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions coreml/whisper-encoder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ void whisper_coreml_encode(
error: nil
];

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

memcpy(out, outCoreML.output.dataPointer, outCoreML.output.count * sizeof(float));
memcpy(out, outCoreML.output.dataPointer, outCoreML.output.count * sizeof(float));
}
}

#if __cplusplus
Expand Down

0 comments on commit 89c66bd

Please sign in to comment.