Fixed several memory leaks (mostly in Cocoa port debugging utils)

This commit is contained in:
Lior Halphon 2017-09-27 22:09:26 +03:00
parent 7a41a9b417
commit 78446f0ed4
3 changed files with 13 additions and 3 deletions

View File

@ -157,7 +157,11 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height,
self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSFullScreenWindowMask) != 0;
[self.view flip];
GB_set_pixels_output(&gb, self.view.pixels);
[self reloadVRAMData: nil];
if (self.vramWindow.isVisible) {
dispatch_async(dispatch_get_main_queue(), ^{
[self reloadVRAMData: nil];
});
}
}
- (void) run
@ -734,8 +738,13 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height,
NULL,
YES,
renderingIntent);
CGDataProviderRelease(provider);
CGColorSpaceRelease(colorSpaceRef);
return [[NSImage alloc] initWithCGImage:iref size:NSMakeSize(width * scale, height * scale)];
NSImage *ret = [[NSImage alloc] initWithCGImage:iref size:NSMakeSize(width * scale, height * scale)];
CGImageRelease(iref);
return ret;
}
- (void) reloadMemoryView

View File

@ -137,7 +137,7 @@ void GB_free(GB_gameboy_t *gb)
}
}
for (int i = 0x400; i--;) {
if (gb->reversed_symbol_map.buckets[i]) {
while (gb->reversed_symbol_map.buckets[i]) {
GB_symbol_t *next = gb->reversed_symbol_map.buckets[i]->next;
free(gb->reversed_symbol_map.buckets[i]);
gb->reversed_symbol_map.buckets[i] = next;

View File

@ -22,6 +22,7 @@
[_backgroundColor release];
[_bookmarkStarts release];
[_bookmarkExtents release];
[_bookmarkEnds release];
[super dealloc];
}