Dener Stassun commited on
Commit
7670fc1
·
unverified ·
1 Parent(s): 54be145

coreml : wrap inference call in @autoreleasepool to fix memory leak (#1218)

Browse files
Files changed (1) hide show
  1. coreml/whisper-encoder.mm +4 -2
coreml/whisper-encoder.mm CHANGED
@@ -53,9 +53,11 @@ void whisper_coreml_encode(
53
  error: nil
54
  ];
55
 
56
- whisper_encoder_implOutput * outCoreML = [(__bridge id) ctx->data predictionFromLogmel_data:inMultiArray error:nil];
 
57
 
58
- memcpy(out, outCoreML.output.dataPointer, outCoreML.output.count * sizeof(float));
 
59
  }
60
 
61
  #if __cplusplus
 
53
  error: nil
54
  ];
55
 
56
+ @autoreleasepool {
57
+ whisper_encoder_implOutput * outCoreML = [(__bridge id) ctx->data predictionFromLogmel_data:inMultiArray error:nil];
58
 
59
+ memcpy(out, outCoreML.output.dataPointer, outCoreML.output.count * sizeof(float));
60
+ }
61
  }
62
 
63
  #if __cplusplus