r/javascript • u/ILikeChangingMyMind • Sep 12 '22
Facebook Open Sources MemLab: A framework for finding JavaScript memory leaks
https://engineering.fb.com/2022/09/12/open-source/memlab/8
12
Sep 13 '22
I guess they needed a tool to fix jest
6
u/binhonglee Sep 13 '22
Jest has been owned by Open JS Foundation for a while now.
https://openjsf.org/blog/2022/05/11/openjs-foundation-welcomes-jest/
2
9
u/mungaihaha Sep 13 '22 edited Sep 13 '22
How does a garbage collected language like JS leak memory?
EDIT: Makes a lot more sense now. Thank you all for the answers
33
u/rk06 Sep 13 '22
Memory Leak in garbage collected world refers to objects which remain accessible (and therefore can't be garbage collected) despite outliving their purpose.
17
11
u/ShortFuse Sep 13 '22
this.element = document.createElement('div'); // Some time later this.element.remove();
this.elementleaks. Same applies with element references in timers and promises. We haveWeakRefnow, but I don't think many outside of vanilla JS devs use them.MDN's reference for WeakRef has an example of how a timer paradigm that usually leaks no longer would with
WeakRef.
1
0
Sep 13 '22
[deleted]
56
u/YodaCodar Sep 13 '22
They needed the tool so they built it. It doesnt mean theyve used it yet…
34
u/MaxUumen Sep 13 '22
They open sourced it so the community can find and fix memory leaks in it. Oh wait...
0
1
Sep 13 '22
Because it's built on php and because the main structure from the original FB site is still there, they've been simply adding stuff for 15 years
0
25
u/F21Global Sep 12 '22
Github repo here: https://github.com/facebookincubator/memlab