I'm looking into ways to save memory in Sencha Touch 2. I see two options, as I'll describe below.
I'd like to get advice on the difference of memory consumption between the two options, and to know if I'm missing anything.
Remove unused components from their containers, and destory them. When they're needed again, re-create them.
Advantage:
this approach can be greatly assisted by container ref's 'autoCreate' option and by container config's 'autoDestroy' option.
Disadvantage:
to re-create the view as it was before destruction, you need to make sure every important piece of information you wish to recreate (e.g. scroll-location in list, map-center in map) is kept as state elsewhere.
Remove unused components from their containers WITHOUT destroying them. When they're needed again, re-attach them to their containers.
Advantages
Disadvantages
I also posted this on the Sencha forums: http://www.sencha.com/forum/showthread.php?200314-Memory-Management-Options
I got the following, rather general answer:
If you remove the component but do not destroy it, you minimize DOM size but of course you still have that component in device memory. The benefit is since DOM size is down, you have better performance and DOM size is going to have a larger impact than having some components in memory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With