Spaces:
Sleeping
Sleeping
Dener Stassun
commited on
coreml : wrap inference call in @autoreleasepool to fix memory leak (#1218)
Browse files
coreml/whisper-encoder.mm
CHANGED
|
@@ -53,9 +53,11 @@ void whisper_coreml_encode(
|
|
| 53 |
error: nil
|
| 54 |
];
|
| 55 |
|
| 56 |
-
|
|
|
|
| 57 |
|
| 58 |
-
|
|
|
|
| 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
|