0

I'm using Extjs-6 for developing my application. I have most than 20 controller in my application. 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).
Is it true that I use destroy function for closing the window? Is this frees memory? This way don't occur leakage memory? In a sentence, What's the best way?

Guilherme Lopes
  • 4,688
  • 1
  • 19
  • 42
Morteza Malvandi
  • 1,656
  • 7
  • 30
  • 73
  • autoDestoy (http://docs.sencha.com/extjs/5.0/5.0.1-apidocs/#!/api/Ext.container.Container-cfg-autoDestroy) is set to true for containers. It is not necessary to destroy anything manually. Maybe the App inspector plugin (https://chrome.google.com/webstore/detail/app-inspector-for-sencha/pbeapidedgdpniokbedbfbaacglkceae) for Chrome will help you to show you which components still exists. – Tarabass Aug 06 '15 at 19:59

1 Answers1

3

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. 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;
Greendrake
  • 3,657
  • 2
  • 18
  • 24
  • If you use a global event bus for communicating across your app, like with say web sockets, make sure you disconnect these handlers. – incutonez Aug 07 '15 at 03:04