简体   繁体   English

使用`Ext.window.Window`类实例后如何释放内存?

[英]How free memory after using `Ext.window.Window` class instance?

I'm using Extjs-6 for developing my application. 我正在使用Extjs-6开发我的应用程序。 I have most than 20 controller in my application. 我的应用程序中最多有20个控制器。 In all of these controllers, some times, these controllers show a Ext.window.Window class instance and then user close this window(In other hands, All controller can show a popup). 在所有这些控制器中,有时,这些控制器显示一个Ext.window.Window类实例,然后用户关闭此窗口(另一方面,All控制器可以显示一个弹出窗口)。
Is it true that I use destroy function for closing the window ? 我使用destroy函数关闭window是否正确? Is this frees memory? 这会释放记忆吗? This way don't occur leakage memory? 这样不会发生泄漏记忆? In a sentence, What's the best wa y? 一句话, 什么是最好的

When close is called (whether as the result of user click, or programmatically), destroy is called behind the scenes, and everything in regards to preventing memory leaks is cared of for you by the framework. 调用close (无论是由于用户单击还是通过编程方式), destroy都会在后台调用,有关防止内存泄漏的所有内容都由框架来照顾。 So, unless there are relevant bugs, you don't need to worry about that at all. 因此,除非有相关的错误,否则您根本不必担心。

It is still a good practice, though, to get rid of any references to objects that no longer exist / in use. 但是,摆脱对不再存在/正在使用的对象的任何引用仍然是一个好习惯。 So, if you somewhere created a reference to you window like this: 因此,如果您在某处创建了对窗口的引用,如下所示:

this.win = Ext.create('Ext.window.Window'....

it will be a good idea to delete it when the window is closed: 最好在关闭窗口后将其删除:

delete this.win;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM