r/Deno • • Aug 10 '24

Common Causes of Memory Leaks in JavaScript

https://www.trevorlasn.com/blog/common-causes-of-memory-leaks-in-javascript
8 Upvotes

12 comments sorted by

3

u/__grunet Aug 10 '24

Great write up! Do you happen to have any recommendations for continuous profiling of JS runtimes in production?

4

u/[deleted] Aug 10 '24

I'm building a new better one in Go.

2

u/__grunet Aug 10 '24

Oh very cool. Is this working with the OTEL sig on profiling or a separate angle?

1

u/m_hans_223344 Aug 11 '24

How are you continuously profile your null-pointer exceptions and race conditions? ;-)

1

u/[deleted] Aug 11 '24 edited Sep 08 '24

[removed] — view removed comment

1

u/jack_waugh Sep 08 '24

I don't know Go. Has a good protocol been designed to link code in Go to the concurrency model (including I/O events) that browsers use (or one suitable for use in them)?

Does Go support an equivalent of JS' generator functions? Note that in JS, data flow can be two-way across yield.

2

u/[deleted] Sep 08 '24

[removed] — view removed comment

1

u/jack_waugh Sep 09 '24

I didn't research whether anyone is implementing golang for browsers (via xlation to JS or WAsm), but if not, maybe someone should.

But if Go semantics requires pre-emptive scheduling, browsers won't support that.

1

u/[deleted] Sep 09 '24

[removed] — view removed comment

1

u/jack_waugh Sep 11 '24

I have code in JS to support threads (without pre-emptive scheduling) in any so-called "single-threaded environment".

1

u/jack_waugh Sep 08 '24

Thanks for mentioning that not all collectors handle circular references properly.