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 !
Dictionaries are prototype structs!! (and all Titanium objects take dictionaries as params)
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)
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
you can always reclaim memory by manually sticking views/objects that you would like to be freed into an empty window then calling close on the window.
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 !!
Hansjuerg, if you post the code for your main memory leak app, instead of accusing Titanium, maybe we could help…