引用:
------------------------------------------------------------------------------------------------------------------
在JavaScript中释放对象占用的内存
今天为了提高客户端的运行效率,开始优化代码,先检查内存释放问题
找到了一个javascript的未公开函数CollectGarbage()
According to MSDN, CollectGarbage is an undocumented function of the language and it is used for testing only. However this is the only way to force the garbage collection in Javascript, setting a variable to null or deleting it will not destroy the resource until the browser engine is destroyed.
我这里试下来每次都能立即释放内存的。
阅读(1287) | 评论(0) | 转发(0) |