Giter Club home page Giter Club logo

Comments (4)

JensRavens avatar JensRavens commented on July 4, 2024

Yes, all signals keep a strong reference to child-signals. But this is somewhat on purpose, otherwise you would have to keep a reference to all signal-chains. Just imagine this case:

textField.textSignal.map(trim).map(downcase).flatMap(sendNetworkRequest)

This chain would never execute because there is no way to capture the signal after the first map.

from interstellar.

vytis avatar vytis commented on July 4, 2024

That is true, didn't realise that chaining wouldn't work. In your example I would expect that you should only need to keep the reference to the last signal created. Not sure how it would be possible to implement this though.

So that also means that any values sent through the signal would also leak? Didn't do any tests but it could have a big impact on overall memory consumption

from interstellar.

JensRavens avatar JensRavens commented on July 4, 2024

It's not actually leaking - the memory is still accessible. As soon as you let go of the initiating signal, the whole graph of signals collapses and get's deallocated.

RxSwift is working around that by having dispose bags, but i would like to keep this implementation is small as possible, so this concept might be overkill.

Also retaining without having a reference is quite a nice feature if you use it with the new subscribeOnce-option that is coming to observable in 2.0 (so signal can be used as a replacement for futures/promises).

from interstellar.

vytis avatar vytis commented on July 4, 2024

Ah ok, then it's not a big problem if everything gets released in the end. Thanks for a nice explanation!

from interstellar.

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.