Spaces:
Running
Running
coreml : fix memory leak (#899)
Browse files
coreml/whisper-encoder.mm
CHANGED
|
@@ -51,15 +51,10 @@ void whisper_coreml_encode(
|
|
| 51 |
|
| 52 |
whisper_encoder_implOutput * outCoreML = [(__bridge id) ctx->data predictionFromLogmel_data:inMultiArray error:nil];
|
| 53 |
|
| 54 |
-
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
//printf("shape: %ld %ld %ld %ld\n", [shape[0] longValue], [shape[1] longValue], [shape[2] longValue], [shape[3] longValue]);
|
| 60 |
-
//printf("strides: %ld %ld %ld %ld\n", [strides[0] longValue], [strides[1] longValue], [strides[2] longValue], [strides[3] longValue]);
|
| 61 |
-
|
| 62 |
-
memcpy(out, outMA.dataPointer, outMA.count * sizeof(float));
|
| 63 |
}
|
| 64 |
|
| 65 |
#if __cplusplus
|
|
|
|
| 51 |
|
| 52 |
whisper_encoder_implOutput * outCoreML = [(__bridge id) ctx->data predictionFromLogmel_data:inMultiArray error:nil];
|
| 53 |
|
| 54 |
+
memcpy(out, outCoreML.output.dataPointer, outCoreML.output.count * sizeof(float));
|
| 55 |
|
| 56 |
+
[outCoreML release];
|
| 57 |
+
[inMultiArray release];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
}
|
| 59 |
|
| 60 |
#if __cplusplus
|