Skip to content

Commit

Permalink
coreml : fix memory leak (ggerganov#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov authored and iThalay committed Sep 23, 2024
1 parent 2132420 commit 683bd38
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions coreml/whisper-encoder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,10 @@ void whisper_coreml_encode(

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

MLMultiArray * outMA = outCoreML.output;
memcpy(out, outCoreML.output.dataPointer, outCoreML.output.count * sizeof(float));

//NSArray<NSNumber *> * shape = outMA.shape;
//NSArray<NSNumber *> * strides = outMA.strides;

//printf("shape: %ld %ld %ld %ld\n", [shape[0] longValue], [shape[1] longValue], [shape[2] longValue], [shape[3] longValue]);
//printf("strides: %ld %ld %ld %ld\n", [strides[0] longValue], [strides[1] longValue], [strides[2] longValue], [strides[3] longValue]);

memcpy(out, outMA.dataPointer, outMA.count * sizeof(float));
[outCoreML release];
[inMultiArray release];
}

#if __cplusplus
Expand Down

0 comments on commit 683bd38

Please sign in to comment.