[AC-1452] ScrollableView crash
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Not Our Bug |
Resolution Date | 2014-09-24T03:11:10.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | crash, crashes, memory, scrollableView, scrollview |
Reporter | Trevor Fifield |
Assignee | Mauro Parra-Miranda |
Created | 2014-09-19T11:01:36.000+0000 |
Updated | 2016-03-08T07:37:53.000+0000 |
Description
I am adding an array of ScrollViews to the ScrollableView object. The views are passed to the object using the setViews method after they have been created in a loop. The ScrollableView is also clipping to expose pages/views either side of the current page.
The ScrollViews for each page contain images that are cropped and blurring applied (native module) and labels and images throughout the page. Each section of elements in the ScrollView are created with controllers.
As is, the ScrollableView crashes when the user hits the second-to-last view in an array of 12 and the last view tries to render. Profiling memory allocations via Xcode Instruments shows a 200mb spike on the last view as opposed to 10mb for all of the other views.
I have tried the following to resolve:
- remove views not on screen via assigning an array of 3 views at a time, removing all child views and nulling them
- using the removeView and addView methods to add/remove views on and off screen
- removal of content within the scrollviews to reduce load (to test if the complexity of the views was the issue)
- removal of the image cropping and blurring functions (to test if this was causing memory leaks via the native module and functions)
Whilst these methods remove the children from the views and the TiUIViewProxy count reduces, they do not remove the views from memory.
Link to test case as too large to upload: https://www.dropbox.com/s/wt3l6z17z48hbz8/ScrollableViewProfiling.zip?dl=0
Removing 3 4mb images from the content in the test case has now stopped the crashing however the issue still remains - child views are still retained in memory when they have been removed using the steps described in the description. This issue will ultimately mean that additional pages added to the ScrollableView will add to the memory stack and it will crash eventually.
Hello, it's likely that if you create a huge scrollview will crash. Please take a look into the infinite scrollview, it might be useful. https://twitter.com/dawsontoth/status/33296100718809088 JFYI, iOS 8 is only supported with Mobile SDK 3.4+. I saw that you are developing with 3.2.3, it's not supported anymore.