6

I am not sure how JavaScript manages its memory and variables.

Is it like .NET where value types are stored on the stack and the type referenced on the heap? Or is everything just saved on the heap? How does it work?

Sebastian Simon
  • 18,263
  • 7
  • 55
  • 75
Avidanda
  • 61
  • 1
  • 1
    See [this](http://stackoverflow.com/questions/6602864/stack-and-heap-in-v8-javascript) – trincot Nov 08 '15 at 18:11
  • @melpomene You could Google it or simply read the tag wiki for the [heap-memory] tag which this question is tagged as. – Sebastian Simon Nov 08 '15 at 18:11
  • @Xufox I checked the tag wiki and it talks about database servers or something. – melpomene Nov 08 '15 at 18:15
  • 1
    Why is the question closed as too broad? Its quite a specific question.. anyways. I think (pretty sure) that javascript memory is handled by the browser, and the browser could do that in a couple of ways but it probably reserves a selection of its own heap for javascript variables when needed. – Niki van Stein Nov 08 '15 at 18:18
  • 2
    It's an implementation detail of the specific JavaScript compiler you care about, so there isn't one true answer. It's also not really a *practical* problem, which is what Stackoverflow is geared towards. It *might* be suitable for the programmers stackexchange. – Quentin Nov 08 '15 at 18:27
  • 1
    @Quentin: The practical answer would be that we don't need to care or worry about, and cannot control it anyway in a web environment. – Bergi Nov 08 '15 at 21:45
  • I agree with BasvanStein, I am not sure why this is closed, the OP asked a valid question, the answers provided in comment section along with some explanation (an overview perhaps with links for further reading) would have answered the question. This would have helped others with the same question. Closing this instead of providing an answer leaves a dent on stackoverflow and an ill user experience. The OP probably did not visit stackoverflow (Last seen Nov 27 '15, 8:18) again as he might have thought that his questions would be considered newbie or too broad that the community would close it – Flying Gambit Feb 28 '16 at 10:40
  • This question definitely should not have been closed – David Callanan Jan 06 '18 at 17:43

0 Answers0