Do you make a custom build via the "builder" provided in the ExtJs package?
Yes. This can help load times but probably won't improve UI snapiness. I wouldn't do this until your app has matured a bit, working with a cut down build gets really annoying when you need to use the bits you've cut out.
How would I make sure they are destroyed?
When a component is created it is registered with the component manager. The component's destroy() method will, among many other things, unregister it with the manager. This is important because the JS garbage collector can't reclaim a component if there's still a reference to it from the manager.
You can see all the components in your app using Ext.ComponentManager.all.
ExtJS does what it can to destroy components for you. When you destroy a container it will destroy all of its children for you. When you remove a component from a container it will, by default, be destroyed. When a window or tab is closed the default is to destroy it.
However, there are still problem cases. Consider a grid with a context-menu for the rows.
First imagine that we listen to the contextmenu (right-click) event and create a new menu each time it fires. Everything looks fine. But when the menu is dismissed it is hidden, not destroyed. Gradually the number of menus will creep up and up. In this case you can even see them in the DOM, hidden but very much still there.
One attempt at fixing this is to reuse the same menu each time. Somewhere during construction the grid could do something like this:
Code:
this.contextMenu = Ext.create('Ext.menu.Menu', {...});
Then, in the contextmenu event listener:
Code:
this.contextMenu.showAt(event.getXY());
This stops the number of menus creeping up each time we right-click a grid row but it doesn't necessarily solve the problem completely. If the grid is destroyed (maybe it's in a tab that gets closed) there's still nothing to destroy the menu. The grid will need some custom logic adding to destroy the menu when it is destroyed.
Going back to the original approach of creating a new menu each time, this can be made to work by destroying the menu in a hide event listener.
This just scratches the surface of some of the memory leaks that can occur. ExtJS does what it can to help you but it can take some time to learn exactly what's tidied up by magic and what you have to do manually. One thing to note is that for many apps these leaks really don't matter. It usually only becomes a problem if your users are using the app for long periods of time. Even then they can reset the page by reopening their browser, so you've got to evaluate whether it's worth the development time to fix them.