gpupixel icon indicating copy to clipboard operation
gpupixel copied to clipboard

[BUG] There are some Memory Leaks in iOS Demo

Open zjn-116373914 opened this issue 7 months ago • 2 comments

Describe the bug There are some Memory Leaks in iOS Demo

How To Reproduce the bug

  1. Import a larger resolution image(3024 * 4032)
  2. Go into ImageFilterController page
  3. Render with some filters
  4. Back to Home page
  5. Repeat steps 2, 3, and 4

Expected behavior There are some Memory Leaks

Screenshots Image

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)

zjn-116373914 avatar Apr 22 '25 08:04 zjn-116373914

Thank you. We will carry out unified memory-related fixes later.

jaaronkot avatar Apr 22 '25 10:04 jaaronkot

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; }

xiaohangfamily avatar Jun 29 '25 04:06 xiaohangfamily