I have a crashing iPad app due to low memory. (iOS 5.0.1, iPad 1, TiSDK 1.8.1)
The app uses a lot of ImageViews & WebViews which are created and destroyed again. I also cache .png & .html files in the Caches/ directory.
I profiled my app using Instruments/Allocations and every proxy object is cleaned up nicely.
When I profile with Instruments/Zombies the Living count keeps going up.
I do not understand why this happens, I'm nulling every instance of every object, removing all eventListeners etc…
Does anyone recognize this problem, if yes, how did you solve it?
LowMemory crash log (notice the count):
Incident Identifier: 8408639E-ED98-4128-BD49-83873A768680 CrashReporter Key: 43a812b85d2fb7125ea67122fef53fc2c17434ba Hardware Model: iPad1,1 OS Version: iPhone OS 5.0.1 (9A405) Kernel Version: Darwin Kernel Version 11.0.0: Tue Nov 1 20:33:58 PDT 2011; root:xnu-1878.4.46~1/RELEASE_ARM_S5L8930X Date: 2012-02-08 11:05:53 +0100 Time since snapshot: 58 ms Free pages: 546 Wired pages: 16895 Purgeable pages: 3 Largest process: MyApp Processes Name UUID Count resident pages MyApp <56570fa64cff32df9091b59fdd72a63b> 23276 (jettisoned) (active)
besides nulling, you should do:
win.add(object); // use the object win.remove(object); object=null;
I have found that there can be a number of things that keep the objects alive. I suggest going through the painstaking process of dissecting you code (ie commenting large blocks out) to workout what is stopping the object from being released. It can be your code, but sometimes the fault is not yours. Sometimes null or win.close() techniques don't work and there can be issues with the framework.
Here are a few that I found in my project:
- Windows animation with callbacks - Ticket.
- Toolbar Proxy with Require - Ticket
- Tabgroups (this is well known) - Ticket.
If you are really stuck, try re-using the various views rather than creating and destroying.