How do I write JavaScript apps that aren't hungry?

Are there rules or guidelines for writing JavaScript code that is not hungry?

At the time when I had to allocate and deallocate every byte in my software, I had a good picture of memory usage in my mind. But now I'm still not sure. All this cross-circular references, closures, duck typing, I'm used to these great features but always feel insecure about memory effects.


source to share

1 answer

Anytime you go out of scope, the garbage collector does its job. So if you move some code into a function that runs and ends, all variables will be garbage collected when the function is completed (except for those that were available before the function was called in the first place).



All Articles