How to destroy a JavaScript object?

后端 未结 5 1543
青春惊慌失措
青春惊慌失措 2020-12-07 17:16

Recently, I came across one of my application which consumes too much memory and increasing by 10 MB/sec.

So, I like to know the best way to destroy JavaScript objec

5条回答
  •  粉色の甜心
    2020-12-07 17:52

    Structure your code so that all your temporary objects are located inside closures instead of global namespace / global object properties and go out of scope when you've done with them. GC will take care of the rest.

提交回复
热议问题