如何手动卸载jQuery库?
问题描述:
我如何手动卸载jQuery库,以便再次释放使用的内存?
How can i manually unload the jQuery library so that the used memory is freed again?
实际的问题是我正在将iquery加载到iframe中,该iframe在更改源之后将jquery保留在内存中,并且不会再次释放它. (有关更多背景信息,请参见使用jquery增加内存使用量)
The actual problem is that I'm loading jquery in an iframe which, after changing the source, keeps jquery in memory and does not free it again. (see increasing memory usage with jquery for more background information)
答
我认为不可能显式释放jQuery使用的内存,但是您可以尝试的一件事是:
I don't think it's possible to explicitly free up the memory used by jQuery, but one thing you can try would be:
window.jQuery = window.$ = undefined;
(根据Matt的评论):
(per Matt's comment):
更好:
delete window.jQuery;
delete window.$;