Cocoa Port: Fix some memory leak issues, especially apparent when running Metal display views.
This commit is contained in:
parent
57dd000496
commit
2e95dda3f5
|
@ -1587,10 +1587,13 @@ public:
|
||||||
|
|
||||||
- (void) runFetchLoop
|
- (void) runFetchLoop
|
||||||
{
|
{
|
||||||
|
NSAutoreleasePool *tempPool = nil;
|
||||||
pthread_mutex_lock(&_mutexFetchExecute);
|
pthread_mutex_lock(&_mutexFetchExecute);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
tempPool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
while (_threadMessageID == MESSAGE_NONE)
|
while (_threadMessageID == MESSAGE_NONE)
|
||||||
{
|
{
|
||||||
pthread_cond_wait(&_condSignalFetch, &_mutexFetchExecute);
|
pthread_cond_wait(&_condSignalFetch, &_mutexFetchExecute);
|
||||||
|
@ -1600,6 +1603,8 @@ public:
|
||||||
[self pushVideoDataToAllDisplayViews];
|
[self pushVideoDataToAllDisplayViews];
|
||||||
_threadMessageID = MESSAGE_NONE;
|
_threadMessageID = MESSAGE_NONE;
|
||||||
|
|
||||||
|
[tempPool release];
|
||||||
|
|
||||||
} while(true);
|
} while(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1796,7 +1801,10 @@ CVReturn MacDisplayLinkCallback(CVDisplayLinkRef displayLink,
|
||||||
void *displayLinkContext)
|
void *displayLinkContext)
|
||||||
{
|
{
|
||||||
MacClientSharedObject *sharedData = (MacClientSharedObject *)displayLinkContext;
|
MacClientSharedObject *sharedData = (MacClientSharedObject *)displayLinkContext;
|
||||||
|
|
||||||
|
NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init];
|
||||||
[sharedData flushAllDisplaysOnDisplayLink:displayLink timeStampNow:inNow timeStampOutput:inOutputTime];
|
[sharedData flushAllDisplaysOnDisplayLink:displayLink timeStampNow:inNow timeStampOutput:inOutputTime];
|
||||||
|
[tempPool release];
|
||||||
|
|
||||||
return kCVReturnSuccess;
|
return kCVReturnSuccess;
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,10 +136,13 @@
|
||||||
|
|
||||||
- (void) runMessageLoop
|
- (void) runMessageLoop
|
||||||
{
|
{
|
||||||
|
NSAutoreleasePool *tempPool = nil;
|
||||||
pthread_mutex_lock(&_mutexMessageLoop);
|
pthread_mutex_lock(&_mutexMessageLoop);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
tempPool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
while (_threadMessageID == MESSAGE_NONE)
|
while (_threadMessageID == MESSAGE_NONE)
|
||||||
{
|
{
|
||||||
pthread_cond_wait(&_condSignalMessage, &_mutexMessageLoop);
|
pthread_cond_wait(&_condSignalMessage, &_mutexMessageLoop);
|
||||||
|
@ -148,6 +151,7 @@
|
||||||
[self handleSignalMessageID:_threadMessageID];
|
[self handleSignalMessageID:_threadMessageID];
|
||||||
_threadMessageID = MESSAGE_NONE;
|
_threadMessageID = MESSAGE_NONE;
|
||||||
|
|
||||||
|
[tempPool release];
|
||||||
} while(true);
|
} while(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -778,33 +778,30 @@
|
||||||
{
|
{
|
||||||
const size_t listSize = cdvFlushList.size();
|
const size_t listSize = cdvFlushList.size();
|
||||||
|
|
||||||
@autoreleasepool
|
id<MTLCommandBuffer> cbFlush = [commandQueue commandBufferWithUnretainedReferences];
|
||||||
|
id<MTLCommandBuffer> cbFinalize = [commandQueue commandBufferWithUnretainedReferences];
|
||||||
|
|
||||||
|
for (size_t i = 0; i < listSize; i++)
|
||||||
{
|
{
|
||||||
id<MTLCommandBuffer> cbFlush = [commandQueue commandBufferWithUnretainedReferences];
|
ClientDisplay3DView *cdv = (ClientDisplay3DView *)cdvFlushList[i];
|
||||||
id<MTLCommandBuffer> cbFinalize = [commandQueue commandBufferWithUnretainedReferences];
|
cdv->FlushView(cbFlush);
|
||||||
|
|
||||||
for (size_t i = 0; i < listSize; i++)
|
|
||||||
{
|
|
||||||
ClientDisplay3DView *cdv = (ClientDisplay3DView *)cdvFlushList[i];
|
|
||||||
cdv->FlushView(cbFlush);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < listSize; i++)
|
|
||||||
{
|
|
||||||
ClientDisplay3DView *cdv = (ClientDisplay3DView *)cdvFlushList[i];
|
|
||||||
cdv->FinalizeFlush(cbFinalize, timeStampOutput->hostTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
[cbFlush enqueue];
|
|
||||||
[cbFinalize enqueue];
|
|
||||||
|
|
||||||
[cbFlush commit];
|
|
||||||
[cbFinalize commit];
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
[commandQueue insertDebugCaptureBoundary];
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < listSize; i++)
|
||||||
|
{
|
||||||
|
ClientDisplay3DView *cdv = (ClientDisplay3DView *)cdvFlushList[i];
|
||||||
|
cdv->FinalizeFlush(cbFinalize, timeStampOutput->hostTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
[cbFlush enqueue];
|
||||||
|
[cbFinalize enqueue];
|
||||||
|
|
||||||
|
[cbFlush commit];
|
||||||
|
[cbFinalize commit];
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
[commandQueue insertDebugCaptureBoundary];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -2528,10 +2525,7 @@ void MacMetalFetchObject::FetchFromBufferIndex(const u8 index)
|
||||||
MacClientSharedObject *sharedViewObject = (MacClientSharedObject *)this->_clientData;
|
MacClientSharedObject *sharedViewObject = (MacClientSharedObject *)this->_clientData;
|
||||||
this->_useDirectToCPUFilterPipeline = ([sharedViewObject numberViewsUsingDirectToCPUFiltering] > 0);
|
this->_useDirectToCPUFilterPipeline = ([sharedViewObject numberViewsUsingDirectToCPUFiltering] > 0);
|
||||||
|
|
||||||
@autoreleasepool
|
[(MetalDisplayViewSharedData *)this->_clientData fetchFromBufferIndex:index];
|
||||||
{
|
|
||||||
[(MetalDisplayViewSharedData *)this->_clientData fetchFromBufferIndex:index];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacMetalFetchObject::_FetchNativeDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex)
|
void MacMetalFetchObject::_FetchNativeDisplayByID(const NDSDisplayID displayID, const u8 bufferIndex)
|
||||||
|
|
Loading…
Reference in New Issue