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

[3.2.0] Excessive Memory leaks in Swift 4.2 related to LineChartView, not present in 3.1.1 w/Swift 4 #3649

Closed
1 task done
RamblinWreck77 opened this issue Sep 18, 2018 · 9 comments
Assignees

Comments

@RamblinWreck77
Copy link

RamblinWreck77 commented Sep 18, 2018

What did you do?

Existing project has charts inside a collection view cell primarily consisting of a LineChartView.

What did you expect to happen?

No leaks

What happened instead?

With no other code changes, the exact same project generates 100's of leaks in Swift 4.2/v3.2.0 and zero in Swift 4.0 / 3.1.1.

The leaks seem to revolve around data items strongly retaining a reference to their parent chart view. Dismissing the page/complete deinit on the UICollectionView works fine, but the more items that go into the chart the more leaks you end up with.

Charts Environment

Charts version/Branch/Commit Number: 3.2.0
Xcode version: 10.0
Swift version: 4.2
Platform(s) running Charts: iOS
macOS version running Xcode: 10.13.6

Demo Project

-Will Update Tomorrow with sample

@liuxuan30
Copy link
Member

about memory leak is a bit tricky, you can look at #2772 #2745. Sometimes it's not Charts problem, but swift library's. You need to give detailed logs, graphs to illustrate.

Also, what I found to make sure the real leak is if you try to pop the current view controller, if chart related objects are still there, that's what you should look into.

@kscheff
Copy link

kscheff commented Oct 7, 2018

I use a separate class for the value formatter following IAxisValueFormatter protocol. In 3.2.0 I get retain cycles between the formatter and my class by using line chart (I have not tested other charts so far). In previous 3.1.1 release I don't get this behavior. I am using latest Xcode 10 (10A255) with Swift 4.2.

@liuxuan30
Copy link
Member

IAxisValueFormatter will create retain cycle if you are not very careful.

@RamblinWreck77
Copy link
Author

RamblinWreck77 commented Oct 12, 2018

Note: This also occurs in 3.2.1

It looks like #3680 will fix it

@liuxuan30
Copy link
Member

please check if #3680 fixed it

@liuxuan30 liuxuan30 self-assigned this Oct 13, 2018
@RamblinWreck77
Copy link
Author

@liuxuan30 It worked! Just ran through a bunch of tests with the current master and it appears to be fixed. Thanks!

@liuxuan30
Copy link
Member

thanks for help confirm!

@dstranz
Copy link
Contributor

dstranz commented Jan 7, 2019

@liuxuan30 Isn't it a good time to create new release of Charts with memory fixes?

@RamblinWreck77
Copy link
Author

@liuxuan30 +1, I would love to switch back to normal charts in my podfile. I've been using the fix in production for months.

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

4 participants