Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to deallocate memory? #85

Open
4 tasks done
Marcin951 opened this issue Feb 8, 2020 · 1 comment
Open
4 tasks done

How to deallocate memory? #85

Marcin951 opened this issue Feb 8, 2020 · 1 comment

Comments

@Marcin951
Copy link

Marcin951 commented Feb 8, 2020

New Issue Checklist

Issue Description

It can take a lot of memory (about 400Mb) and CPU 50%, how I can delete magnetic when the user doesn't need it?
magnetic!.removeAllChildren() magnetic!.removeFromParent() magnetView.removeFromSuperview()
It doesn't help
https://imgur.com/a/Xy3NM5q screens after open view with magnetic views
And implementation of magnetic view (i have 4 magnetic views there, but user needs it only for a while, also i have this with tab bar so i'm not able to dismiss view)
@IBOutlet weak var magneticView: UIView! @IBOutlet weak var nextMagneticButton: UIButton! weak var magnetic: Magnetic? var magnetView: MagneticView! func loadMagnetic(){ view.removeGestureRecognizer(tapGesture) magnetView = MagneticView(frame: self.magneticView.bounds) magnetView.backgroundColor = .clear magnetic = magnetView.magnetic magnetic!.magneticDelegate = self self.magneticView.addSubview(magnetView) self.magneticView.bringSubviewToFront(nextMagneticButton) magnetic!.backgroundColor = .clear for i in 0..<stylesText.count{ let node = Node(text: stylesText[i], image: nil, color: UIColor.init(hexFromString: "FFFFFF", alpha: 0.15), radius: 50) self.magnetic!.addChild(node) }

Environment

  • iOS Version: [13.3.1]
  • Device(s): [iPhone XS Max]
@rimalamir
Copy link

I commented out this chunk of code, now memory is released once the magnetic goes out of scope. File: MagneticView, line: 32

func commonInit() {
//        accessibilityCreateSelectionRotor(withName: "Selected", usingScene: magnetic)
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants