Appcelerator Q&A Archive

Search the archived Community Support

i can’t believe it ! since months there is a heavy memory leak in Titanium. We can’t create good looking Apps for iPad with lots of graphics. Now i’m working since October 2010 on a iPad App but can’t go further beacuse of the memory leaks! Dear Appcelerator team, you did a great work and Titanium is really cool and special, but please in the name of all App developers. Please give us the posibilities to free memory by our self ! The “REMOVE” command is useless, because it does not free the memory !

2011, March 19th by Hansjuerg Wuethrich in Q&A 2010-2014


  • Hansjuerg:

    It is important to understand that Titanium is a proxy pseudo compiler for JavaScript that delegates some handling to both iOs and Android to end up doing the rest of the work. In Java which is a completely GarbageCollector Orientated Langage: you still need to have some precautions in order to avoid eating up all the memory. JavaScript is no exception. I found myself very frustrated at first with Titanium, but we have to realize that this is JavaScript doing fishy stuff, not Titanum; and we only realize it because finally we are working with limited specs devices instead of PCs and WebBrowsers.

    I’ve come to realize that most of the problems posted in this forum are because people think of JavaScript as a poor wannabeC seudolanguage, when in fact its [almost] at Python’s level, which is by far one of the most beautiful languages on earth :) If you wish to use Titanium but won’t bother extending your JavaScript knowledge… it’s bound to blow up in your face

    Some key JavaScripts concepts that if you study further will help understand the management of memory:

    • Prototype-Orientated

    • Parasitic inheritance

    • Dictionaries are prototype structs!! (and all Titanium objects take dictionaries as params)

    • Garbage Collection in JavaScript

    • Using commonJS and exports/require wisely (look for titanium require monkeypatch)

    • Assignments ARE References (this is the C equivalent to the pointer of the object and not the object itself)

    • Null assignment

    • Deep Copy

    • ‘new’ keyword

    Finally some Titanium specific recommendations:

    • include and require are not enemies, know when to use each one

    • Avoid ‘new’ when possible, or the ghost instances will end up haunting you

    • Know where to addListeners. in a Table you can add either 1 listener and search for the firing row, or add listeneres to every row… which turns into more objects, which feeds the GC…

    • If you cling all your objects to a “memory cleaning”, the GC will fail to detect it… and you have to do the cleaning yourself.

    • Know your local resources: FireEvents with dictionaries attached, Titanium.App.Properties, sqlite, folders (including cache)

      • Know your folders: Resources, applicationDirectory, applicationSupportDirectory, externalStorageDirectoy, etc.

        • Cache what you can in folders that the user can dispose
    2012, May 9th by JC Guerrero


    • Dear JC Guerrero !

      Thank you so much for your answer, and your time to write all this ! i know, you are right, and as i said, i love Titanium and the guys behind Appcelerator. RESPECT !! But some time, it is really frustrated. i worked 10 months on my app (alone) and then i found the memoryleak :-( My App is in the appstore and it works on iPad2 and the new iPad. But on iPad1 (because of the small RAM “256MB”) the app crashes often after some minutes (3 - 6 Min) and this makes me Arrrgghhhhh , but anyway !! Thanks again for your great answer ! And it’s also good to know, that i’m not alone with this problem :-) I will try some things you wrote !

      Greetings from Switzerland!

      By the way: This is the app “ConsolesHD”
      inline ConsolesHD in iTunest

      2012, May 9th by Hansjuerg Wuethrich
  • First of all. i still love Appcelerator Titanium. They did a great job for a great framework !! But i’m frustrated (and i’m not alone with this!!). As i told you, i’m working since Oktober 2010 on a project and now in the halftime i get this memory leak error. This makes me crazy and frustrated, because i can’t fix the error by my self. After the use, i remove all the unused objects in the code : mainWindow.remove(Logo01); and so on, but the objects still remains in memory and after 2 minutes of use the app hangs up !

    I do not accuse the Appcelerator Titanium Team , i was just frustrated. Please let me say “SORRY!!”

    I’m looking forward for the 1.7 Update. Thank you !!

    2011, March 20th by Hansjuerg Wuethrich


    • 2011, March 20th by Neil Whitehead
    • Yeahh ! I have to test it! Thank you !

      2011, March 20th by Hansjuerg Wuethrich
    • I only see 1.6.2 …? where do you find 1.7?

      2011, March 20th by Alexander van der Werff
    • Drop-down-menu -> Master

      2011, March 20th by Hansjuerg Wuethrich
    • k, thanx, I tried it, but not really a difference.

      2011, March 21st by Alexander van der Werff
    • with 1.7 there is still the same Problem ! After 120 - 180 Seconds, the App says “Bye bye Baby !” Memory Overflow :-(

      2011, March 27th by Hansjuerg Wuethrich
    • Unfortunately I have the same problem. Because of some fixes in 1.7 and 1.8. I now switched my project to (my app is already available in the app store). Since using 1.8 (before 1.6) my memory problems got even worse! In principal the new app update is done, but I cannot submit to the app store because after playing the app for about 10 minutes nearly all memory has gone! I feel a little bit lost.

      2012, January 7th by Stephan Lenhart
  • Hansjuerg, if you post the code for your main memory leak app, instead of accusing Titanium, maybe we could help…