Comments (3)
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.
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:
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.
@tniezurawski we have global ref for few cases:
- If there is no context on template.
- 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:
- register destructor inside modifier, but binded to app instance (
getOwner(this)
). - implement app-initializer flow to register / remove globalRef
from ember-ref-bucket.
Related Issues (14)
- Figure out why CI is failing
- Please supply typescript types HOT 5
- modifier transforms don't appear to work HOT 2
- bubble mutationObserver options up to modifier HOT 5
- Class constructor SetTransform cannot be invoked without 'new' HOT 7
- Add github CI tests
- fix embroider CI
- Ember modifier v3 depreciation HOT 3
- use WeakRef in element getter HOT 1
- It breaks when using options for `{{create-tracked-ref}}` HOT 2
- `create-ref` doesn't seem to clean up after element is destroyed HOT 12
- warning ember-ref-bucket.no-preprocessor HOT 2
- attempt to register destructor on destroyed object (in tests) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-ref-bucket.