effects-library icon indicating copy to clipboard operation
effects-library copied to clipboard

App terminated due to memory issue

Open MartinAtElitappar opened this issue 2 years ago • 1 comments

Hi, thanks for this nice effect-library! I use ConfettiView which works perfectly. Unfortunately, this is not the case with FireWorksView, which causes memory problems. When I run FireWorksView it doesn't release all the memory, and running it again makes the problem even more apparent. Then it consumes memory continuously and builds more and more memory until the app crashes. I am running SwiftUI and latest release of iOS and Xcode.

MartinAtElitappar avatar Mar 13 '23 21:03 MartinAtElitappar

Looks like the issue is that fireworks explosions are continually added to the scene and never removed. A quick fix is in FireworksScene.swift, at the end of func explosion(at point: CGPoint), to add:

DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { node.removeFromParent() }

(I'd put in a PR for this, but looks like this is an old issue and the repo is not really being maintained)

jonklein avatar Nov 13 '23 20:11 jonklein