Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Best Practice: Do closed windows reside in memory?

While I'm not new to JS programming, I certainly am to the idea of Windows and Views. The app I'm working on will have a number of windows that may or may not be needed (such as logging in or choosing a profile), but will be needed more often than not in a browsing session.

Can I create all of my windows, input fields, table views (with no data), etc and then keep them closed? What type of impact does that have on the app performance?

I'm using events to determine when to show and hide windows, but the only other option I can see is to create a function that builds the window – after first checking to see if it exists – and that seems like a headache of maintaining global variables.

Appreciate any advice on the issue…


— asked May 2nd 2010 by Nathan Ziarek
  • views
  • windows

2 Answers

  • I rad somewhere that javascript handles all the garbage collection for you so you need not worry about such things.

    When I am not using the resources, I can set it to NULL. For example, win = NULL;

    — answered May 3rd 2010 by Peter Lum
  • I was doing (creating the resources at the start of the app and add them only when needed ) but on my 2nd gen ipod this lead to slowness and sometimes to crash - the crash reporter logged low memory when the mail background program kicked in.

    So I started to create the resources when I needed them, and things improved.

    Also for all the sounds I use, I make a release when not needed, and when I use images I try to use the exact image size I need and optimize them before with ImageOptim.

    — answered May 3rd 2010 by Dan Tamas
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.