r/javascript • • Oct 11 '17

JavaScript's Promise is Memory Unsafe

https://alexn.org/blog/2017/10/11/javascript-promise-memory-unsafe.html
70 Upvotes

77 comments sorted by

View all comments

13

u/lachlanhunt Oct 11 '17

I tried that code in node 7.10.1 and 8.6.0. It didn't crash at all. It just endlessly printed numbers until I killed it.

1

u/cwmma Oct 11 '17

I wonder if it has to do with async stack traces

8

u/alexelcu Oct 11 '17

No, it's simply Promise's implementation.

An implementation that works correctly is possible, as can be seen in Funfix's PR, which is a port of the solution implemented by Scala's Future.