ggerganov commited on
Commit
69b02c0
·
unverified ·
1 Parent(s): 3f26c89

coreml : fix memory leak (#899)

Browse files
Files changed (1) hide show
  1. coreml/whisper-encoder.mm +3 -8
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
- MLMultiArray * outMA = outCoreML.output;
55
 
56
- //NSArray<NSNumber *> * shape = outMA.shape;
57
- //NSArray<NSNumber *> * strides = outMA.strides;
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