mirror of https://github.com/axmolengine/axmol.git
fix memory leak for metal app
This commit is contained in:
parent
302007976a
commit
e9a33903f0
|
@ -195,6 +195,7 @@ private:
|
|||
|
||||
dispatch_semaphore_t _frameBoundarySemaphore;
|
||||
RenderPassDescriptor _prevRenderPassDescriptor;
|
||||
NSAutoreleasePool* _autoReleasePool = nil;
|
||||
};
|
||||
|
||||
// end of _metal group
|
||||
|
|
|
@ -220,6 +220,7 @@ CommandBufferMTL::~CommandBufferMTL()
|
|||
|
||||
void CommandBufferMTL::beginFrame()
|
||||
{
|
||||
_autoReleasePool = [[NSAutoreleasePool alloc] init];
|
||||
dispatch_semaphore_wait(_frameBoundarySemaphore, DISPATCH_TIME_FOREVER);
|
||||
|
||||
_mtlCommandBuffer = [_mtlCommandQueue commandBuffer];
|
||||
|
@ -366,6 +367,7 @@ void CommandBufferMTL::endFrame()
|
|||
[_mtlCommandBuffer commit];
|
||||
[_mtlCommandBuffer release];
|
||||
DeviceMTL::resetCurrentDrawable();
|
||||
[_autoReleasePool drain];
|
||||
}
|
||||
|
||||
void CommandBufferMTL::afterDraw()
|
||||
|
|
Loading…
Reference in New Issue