Titanium Community Questions & Answer Archive

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

Memory leaks (releasing memory)?

Hi there,

It seems like Titanium causes memory leaks, on the iPad at least - can anyone confirm this, or tell me what I'm doing wrong?

I'm using a function spawned by calls to setTimeout to change the backgroundImage of some views. This process seems to often result in the device running out of memory and crashing. I'm not sure whether it's the use of backgroundImage (which seems to consume more memory than setting 'image') or setTimeout or a combination of the two. I'm using clearInterval to clean up the timed events.

If anyone's got any tips as to how I might fix this problem I'd love to hear them!

Thanks,

Toby

— asked October 18th 2010 by Toby Mathews
  • backgroundimage
  • crash
  • ipad
  • memory
  • settimeout
1 Comment
  • PS I see this has been mentioned before, and a bug raised, although it doesn't seem it went any further than that - anyone from Appcelerator able to comment?

    http://developer.appcelerator.com/question/46021/release-memory-imageview

    — commented October 18th 2010 by Toby Mathews

2 Answers

  • Accepted Answer

    I have seen a memory leak when using setTimeout. There's a Lighthouse ticket for it, and you can't fix it unless you modify the Objective C in your project (which detaches it from your Titanium project thereafter).

    — answered October 18th 2010 by Clifton Labrum
    permalink
    2 Comments
    • Ouch! We're using Titanium in order to avoid Objective C; I'm actually at the point now (several weeks in) where I'm regretting that decision…one to put down to experience I guess!

      Thanks for taking the time to answer Clifton!

      — commented October 19th 2010 by Toby Mathews
    • I know this is an old topic, but does anyone know if this setTimeout issue has been fixed? I can't seem to access the lighthouse project.

      — commented September 27th 2011 by Jude Osborn
  • Using DDMS i found that Memory allocated to application is get increases as i am navigating screen by screen and after some time it crash application with force close message/Fail to load resources. Even i have remove all objects from window and after that assign null to it. i.e
    window.remove(viewname);
    viewname=null;
    window.close();
    window=null.
    Please help Me OUT.

    — answered February 16th 2012 by Fernan Delgado
    permalink
    2 Comments
    • Feran, Im also facing the same issue

      — commented March 13th 2013 by ankur garha
    • I am also facing the same problem..can anybody help us…

      — commented May 2nd 2013 by kabindra simkhada
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.