4

I am creating a node application that generates scripts for test cases. I am getting the feel that in case of large codes the scripts or javascritp files generated are taking up high memory.

I would like to know how much memory is allocated to javascript variables. The reason I want to know the same is that I would like to free memory to make my application faster in case it is taking in more memory.

The duplicate or so called duplicate question was actually concerned about the memory allocation/de-allocation in Javascript which I am aware of. The intent of the question is that

a) Do we need to think about memory issues making our app slower in javascript node.js based applications?

b) If the reply to the above question is yes, how do we know which Javascript objects are not in use anymore and hence deallocate any memory assigned to it forcefully(if Javascript provides any such option which I am not aware of)?

Jyotirmoy Pan
  • 837
  • 2
  • 10
  • 28
  • 1
    You should first see how much memory Node is consuming while running the script. Tracking down the memory usage of individual variables is usually a waste of time. – JJJ Jun 12 '15 at 11:13
  • 1
    Also, if your app is running too slow, memory consumption is very rarely the #1 reason. – JJJ Jun 12 '15 at 11:19
  • 2
    `window.performance.memory` gives access to JavaScript memory usage data. – Aabid Jun 12 '15 at 11:24
  • 2
    @Aabid - OP is asking about a node application, so no `window`. – nnnnnn Jun 12 '15 at 11:26
  • May this link will useful for you, [Link 1][1] [Link 2][2] [1]: http://stackoverflow.com/questions/1026495/does-javascript-have-a-memory-heap?lq=1 [2]: http://stackoverflow.com/questions/582134/how-is-the-memory-allocation-done-for-variables-in-scripting-languages?lq=1 – Prince of Sweet heart Jun 12 '15 at 12:25
  • I think the duplicate question answers the query that memory allocation is abstracted by browser. Thanks. :) – Jyotirmoy Pan Jun 16 '15 at 05:17

0 Answers0