aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorNicholas Tay <nick@windblume.net>2023-07-26 22:21:15 +1000
committerNicholas Tay <nick@windblume.net>2023-07-26 22:21:15 +1000
commit7d2f0751d0043a4f5ac0c1a6118622202e4e9e47 (patch)
tree52fea3c33a9ed32eae02e6233aac690ef973fad2 /platform
parent2565b0e28ff2c58dd3f34624a71c7a2acaac0a0a (diff)
downloadclak-7d2f0751d0043a4f5ac0c1a6118622202e4e9e47.tar.gz
clak-7d2f0751d0043a4f5ac0c1a6118622202e4e9e47.tar.bz2
clak-7d2f0751d0043a4f5ac0c1a6118622202e4e9e47.zip
macOS fix memory leak (hopefully)HEADmaster
I think it's this simple, maybe I got confused by the memory going up a bit. But I think this actually works, simply releasing should ARC cleanup, and the memory goes up a bit just because of the NSCache but doens't go up further. Again it'd be nicer to use some different lower level way of playing, but this is definitely good enough for now.
Diffstat (limited to '')
-rw-r--r--platform/darwin-native.m2
1 files changed, 1 insertions, 1 deletions
diff --git a/platform/darwin-native.m b/platform/darwin-native.m
index 633d04b..07ca714 100644
--- a/platform/darwin-native.m
+++ b/platform/darwin-native.m
@@ -15,7 +15,6 @@ static NSCache *audio_cache = nil;
@implementation ClakMacSound
- (void)sound:(NSSound *)sound didFinishPlaying:(BOOL)flag {
[sound release];
- [sound dealloc];
}
@end
static ClakMacSound *clak_mac_sound = nil;
@@ -52,6 +51,7 @@ void macos_sound_play(unsigned char *buffer, unsigned int buffer_len)
}
NSSound *sound = [[NSSound alloc] initWithData:buffer_ns];
+ sound.delegate = clak_mac_sound;
[sound play];
}