You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • The memory used isn't continuous, but that's by design and not too much of an issue.

    It's more that with JS you have this idea of an execution scope. So take this example:

    function a() {
      var b = 42;
      return function() { return b; };
    }
    getB = a();
    getB(); // returns 42
    

    The getB function isn't just function() { return b; } - it contains a pointer to the 'execution scope' of a so it can access the value of b.

    So in this case, E.getSizeOf(getB) returns a value much bigger than E.getSizeOf(function() { return b; }). It makes some sense here, but when you get to bigger projects, it can make it difficult to find out where your memory is actually being used.

About

Avatar for Gordon @Gordon started