gpupixel
gpupixel copied to clipboard
[BUG] There are some Memory Leaks in iOS Demo
Describe the bug There are some Memory Leaks in iOS Demo
How To Reproduce the bug
- Import a larger resolution image(3024 * 4032)
- Go into ImageFilterController page
- Render with some filters
- Back to Home page
- Repeat steps 2, 3, and 4
Expected behavior There are some Memory Leaks
Screenshots
Running Information(please complete the following information):
- GPUPixel Version using : v1.3.0-beta.7
- Operating System: macOS 14.4.1
- Device Info: Mac mini(2023)
Thank you. We will carry out unified memory-related fixes later.
CADisplayLink has a strong reference to self, try this code on viewWillAppear/WillDisappear
-
(void)startRender { self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(displayLinkDidFire:)]; self.displayLink.paused = YES; self.displayLink.preferredFramesPerSecond = 30; [self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; self.displayLink.paused = NO; }
-
(void)cancelRender { self.displayLink.paused = YES; [self.displayLink invalidate]; self.displayLink = nil; }