Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1652] iOS: Large or multiple downloads crash the app with NSInvalidArgumentException

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNeeds more info
Resolution Date2015-09-29T01:01:27.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterSzymon Tomasz Stefanek
AssigneeShak Hossain
Created2014-11-20T10:07:18.000+0000
Updated2016-03-08T07:38:08.000+0000

Description

After a number of large downloads made via TiHTTPClient the application crashes on RAM allocation. It's almost like it's keeping the whole downloaded data in memory and not freeing it.
ERROR] :  The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] :  Reason:
[ERROR] :  *** NSAllocateMemoryPages(236102400) failed
[ERROR] :  Stack trace:
[ERROR] :  
[ERROR] :  0   CoreFoundation                      0x24d3fe3f <redacted> + 126
[ERROR] :  1   libobjc.A.dylib                     0x327f3c8b objc_exception_throw + 38
[ERROR] :  2   CoreFoundation                      0x24d3fd85 <redacted> + 0
[ERROR] :  3   Foundation                          0x259ec989 NSAllocateMemoryPages + 92
[ERROR] :  4   Foundation                          0x259c4561 <redacted> + 24
[ERROR] :  5   Foundation                          0x25993c09 <redacted> + 220
[ERROR] :  6   Foundation                          0x25993b23 <redacted> + 78
[ERROR] :  7   Foundation                          0x259a151b <redacted> + 118
[ERROR] :  8   Museo900                            0x0029466b Museo900 + 1807979
[ERROR] :  9   Museo900                            0x0029472d Museo900 + 1808173
[ERROR] :  10  Museo900                            0x00296705 Museo900 + 1816325
[ERROR] :  11  CFNetwork                           0x2489d5a1 <redacted> + 56
[ERROR] :  12  Foundation                          0x25a39ae1 <redacted> + 8
[ERROR] :  13  Foundation                          0x259a4b7d <redacted> + 148
[ERROR] :  14  Foundation                          0x25997337 <redacted> + 774
[ERROR] :  15  Foundation                          0x25a3c44b <redacted> + 186
[ERROR] :  16  libdispatch.dylib                   0x32d5b651 <redacted> + 952
[ERROR] :  17  libdispatch.dylib                   0x32d5609d <redacted> + 84
[ERROR] :  18  libdispatch.dylib                   0x32d5cba1 <redacted> + 320
[ERROR] :  19  libdispatch.dylib                   0x32d5dcd7 <redacted> + 94
[ERROR] :  20  libsystem_pthread.dylib             0x32eb4e31 _pthread_wqthread + 668
[ERROR] :  21  libsystem_pthread.dylib             0x32eb4b84 start_wqthread + 8
[ERROR] :  *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** NSAllocateMemoryPages(236102400) failed'
[ERROR] :  *** First throw call stack:
Another stack, different (small) download size:
[ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
Reason:
*** NSAllocateMemoryPages(183259200) failed
Stack trace:
0   CoreFoundation                      0x24d3fe3f <redacted> + 126
1   libobjc.A.dylib                     0x327f3c8b objc_exception_throw + 38
2   CoreFoundation                      0x24d3fd85 <redacted> + 0
3   Foundation                          0x259ec989 NSAllocateMemoryPages + 92
4   Foundation                          0x259c4561 <redacted> + 24
5   Foundation                          0x25993c09 <redacted> + 220
6   Foundation                          0x25993b23 <redacted> + 78
7   Foundation                          0x259a151b <redacted> + 118
8   Museo900                            0x0038733b Museo900 + 2753339
9   Museo900                            0x003873fd Museo900 + 2753533
10  Museo900                            0x003893d5 Museo900 + 2761685
11  CFNetwork                           0x2489d5a1 <redacted> + 56

Comments

  1. Szymon Tomasz Stefanek 2014-11-20

    I should add that: - the very same code works reliably on Android (tried different devices) - the out-of-memory condition can't be handled from javascript in any way - limiting the number of concurrent downloads to 1 avoids the problem
  2. Shuo Liang 2014-11-21

    Please provide a test case to reproduce this problem, Thanks

JSON Source