Giter VIP home page Giter VIP logo

Comments (3)

lifeart avatar lifeart commented on June 1, 2024

Hey @tniezurawski! Thank you for report! Likely it's related to global ref workaround https://github.com/lifeart/ember-ref-bucket/blob/master/addon/utils/ref.js#L17
there is no cleanup logic for it. We could try to register app destructor to null this ref

from ember-ref-bucket.

tniezurawski avatar tniezurawski commented on June 1, 2024

Thanks @lifeart I literally was about to write about it 😅 Because I was playing with the addon code directly in node_modules and introducing a clean-up function that fixes the memory leak:

image

image

Likely it's related to global ref workaround

Could you tell me more about the workaround? Would a code like that on my screenshots be ok? I can prepare a PR tonight/tomorrow.

EDIT: That implementation is probably too naive. I'm afraid of the "last" word in the name of the variable. I guess, before removing it we should check if that's the same "local ref" as "last global ref" if I understand it correctly. Anyway, I'll know more with some explanation about the workaround 😉

from ember-ref-bucket.

lifeart avatar lifeart commented on June 1, 2024

@tniezurawski we have global ref for few cases:

  1. If there is no context on template.
  2. If we need to have access to DOM element from different parts of application.

Ideally, we need to set globalRef in application initializer (once), and create application level destructor to null it once application destroyed.

But, I don't remember why we don't have it in app instance initializer.. (maybe I'm lazy ass to write it initially).
That's why we set it in modifier, because once anybody use this addon, modifier will exist anyway.

Proposed fix looks good (binding cleanup to modifier cleanup, but may have side effects with multiple modifiers - first removed will null global ref and may cause runtime erros)

We could try do few things:

  1. register destructor inside modifier, but binded to app instance (getOwner(this)).
  2. implement app-initializer flow to register / remove globalRef

from ember-ref-bucket.

Related Issues (13)

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.