Giter Site home page Giter Site logo

Retain Cycles about truetime.swift HOT 9 CLOSED

instacart avatar instacart commented on August 11, 2024
Retain Cycles

from truetime.swift.

Comments (9)

otymartin avatar otymartin commented on August 11, 2024 3

hey @msanders truetime is still leaking quite abit.
This from memory debugger are all truetime related.
From Xcode 9, Swift 4, iOS 10 target.
screen shot 2017-10-21 at 2 51 28 pm

from truetime.swift.

msanders avatar msanders commented on August 11, 2024

@otymartin: Thanks for reporting. Was having trouble reproducing but seeing a similar issue now when testing against recurrent timeouts / bad network conditions. Is this related to the scenario you were seeing this in?

from truetime.swift.

msanders avatar msanders commented on August 11, 2024

@otymartin: This should be fixed now on master and will be included in 4.1.4. Let me know if you run into anything else!

from truetime.swift.

otymartin avatar otymartin commented on August 11, 2024

@msanders
Excuse the late response. Dont know how to answer your question.
I reference TrueTime like this in all my scenarious where I may need to make a network call depended on server time eg. performing transactions. And right before using it, as a safety check I always use guard statement to check if now() exists or fetchInNeed() if now() is nil.

Ill check the new master and report back with any other memory issues.

 fileprivate var now: Date? {
        return TrueTimeClient.sharedInstance.referenceTime?.now()
    }
...
guard let now = self.now else {
            TrueTimeClient.sharedInstance.fetchIfNeeded()
            return
        }

from truetime.swift.

miketsprague avatar miketsprague commented on August 11, 2024

This is a bit strange. I'm seeing the same behavior in my app, specifically running this causes 10 leaks according to xcode:

        for i in (0..<10) {
            TrueTimeClient.sharedInstance.fetchIfNeeded()
        }

But I'm unable to reproduce the memory leak in the example project. Could there be a retain cycle in NTPConnection.swift's close? This is calling lockQueue.async(execute: work), where work has a strong reference to self. Does the lockQueue have a strong reference to the work closure (and we have a strong reference to lockQueue)?

Specifying [self weak] in the capture list for that closure "fixed" the issue in my project, but I'm unsure as to why I'm unable to reproduce it in the example project.

Additional reference, I'm using commit 8aadebabe2590d6ab295c390df5bbc109b346348 via cocoapods in my project.

from truetime.swift.

sangios avatar sangios commented on August 11, 2024

I faced the issue as @msanders reported

from truetime.swift.

sangios avatar sangios commented on August 11, 2024

The issue still happens.

from truetime.swift.

Bruce9487 avatar Bruce9487 commented on August 11, 2024

Have any idea to fix memory leak?

from truetime.swift.

santanaNogueira avatar santanaNogueira commented on August 11, 2024

Did anyone find a solution to this issue? Thanks in advance!

from truetime.swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.