Can I trigger JavaScript's garbage collection?

后端 未结 9 2065
不知归路
不知归路 2021-01-31 07:17

I want to trigger JavaScript garbage collection. Is it possible? Why would I want to, or not want to, do this?

9条回答
  •  面向向阳花
    2021-01-31 07:38

    This answer suggests the following garbage collection request code for Gecko based browsers:

        window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
          .getInterface(Components.interfaces.nsIDOMWindowUtils)
          .garbageCollect();        
    

提交回复
热议问题