Issue description
I'm building an amortisation calculator as part of a financial calculator app.
Since amortization tables are fairly lengthy, I'm using a ListView with two different versions of the ListView data to simulate a list expansion effect. On itemclick, .replaceSectionAt() is called to replace a section of the summarized list with data from another object. Any open section is replaced again with the summarized version.
This is working flawlessly on iOS, but crashes after several clicks on Android 4.4.2. Testing on older Android versions causes an immediate crash. The console returns the error:
[INFO] : libc: Fatal signal 11 (SIGSEGV) at 0x00000014 (code=1), thread 1334 (KrollRuntimeThr)
The error can be replicated by clicking on "Show more" in the app several times on an Android device.
Alloy Sample:
https://www.dropbox.com/s/hdsudc0mkiw1fzr/list-view-crash-app.zip
[~skypanther] Note last comment. Probably worth taking a quick look.
Updated Classic project attached
This is not an Alloy issue. First, the customer's project uses Alloy for only the outermost app structure. The ListView is created and manipulated using Classic-style code. Second, I could not get the Case2067.zip app to run on either iOS or Android. So, I re-created a Classic version from the customer's Alloy version. See the timob17142.zip file attached. It runs as expected on iOS. On Android, it crashes with the error as described in this ticket. Errors like "Fatal signal 11 (SIGSEGV) at 0x00000014" usually indicate something is attempting to access an object that doesn't exist or the app is out of memory.
Thanks for sharing your findings, Tim. Updated 'Case2067.zip'. The only difference is "underscore" module usage. Although when its removed the application runs a bit longer, then Fatal signal 11 is thrown. On my testing, while profiling allocations I did notice the memory consumption is too high (nearly 85% is used) on both Classic and Alloy.
master PR: https://github.com/appcelerator/titanium_mobile/pull/5807
Tested the attached app timob17142.zip with the SDK having the fix & I still see the error:
Environment: Appc Studio : 3.4.0.201408270900 Ti SDK : 3.4.0.v20140826143313 Mac OSX : 10.9.4 Alloy : 1.5.0-dev CLI - 3.4.0-dev Code Processor: 1.1.1 Android 4.4.4
Reopening based on Lokesh's comment.
The root reason for this issue is the same as TIMOB-14393. In the project "timob17142.zip", "sectionsAftBk" which is an array of ListSection is not attached to the window. When there is a memory pressure, those ListSection might be get cleaned up by GC. That's why the app crashes. There is a workaround. If you want those ListSection to be kept while the window is open, you can set it as the window property
Hi Ping, I was able to use your workaround to solve my problem. Thanks for your help! Blaine
Closing ticket as duplicate as the relevant ticket is linked above.