[AC-2735] Android: ScrollView does not allow more than 512 elements
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Needs more info |
Resolution Date | 2012-07-31T05:44:48.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | android, scrollview |
Reporter | Dominik Spengler |
Assignee | Shak Hossain |
Created | 2012-07-25T07:05:32.000+0000 |
Updated | 2016-03-08T07:47:37.000+0000 |
Description
I am trying to add more than 500 elements into a ScrollView from a db with a loop on Android.The app always crashes with a little more than 500 elements added with the following error message:
D/dalvikvm( 8296): GC_CONCURRENT freed 1200K, 23% free 7569K/9799K, paused 2ms+31ms
E/dalvikvm( 8296): JNI ERROR (app bug): local reference table overflow (max=512)
W/dalvikvm( 8296): JNI local reference table (0x21e410) dump:
W/dalvikvm( 8296): Last 10 entries (of 512):
W/dalvikvm( 8296): 511: 0x413d7630 java.lang.String "fontWeight"
W/dalvikvm( 8296): 510: 0x413d75d0 java.util.HashMap
W/dalvikvm( 8296): 509: 0x413d7590 java.lang.String "font"
W/dalvikvm( 8296): 508: 0x413d7320 java.util.HashMap
W/dalvikvm( 8296): 507: 0x413d7308 java.lang.Object[] (1 elements)
W/dalvikvm( 8296): 506: 0x413d7298 java.lang.String "app://ui/common/... (29 chars)
W/dalvikvm( 8296): 505: 0x413c89d8 java.lang.String "50dp"
W/dalvikvm( 8296): 504: 0x413759d0 java.lang.String "50dp"
W/dalvikvm( 8296): 503: 0x41337138 java.lang.String "50dp"
W/dalvikvm( 8296): 502: 0x41377488 java.lang.String "50dp"
W/dalvikvm( 8296): Summary:
W/dalvikvm( 8296): 1 of java.lang.Object[] (1 elements)
W/dalvikvm( 8296): 507 of java.lang.String (507 unique instances)
W/dalvikvm( 8296): 2 of java.util.HashMap (2 unique instances)
W/dalvikvm( 8296): 1 of org.appcelerator.kroll.runtime.v8.V8Runtime
W/dalvikvm( 8296): 1 of org.appcelerator.titanium.proxy.ActivityProxy
E/dalvikvm( 8296): Failed adding to JNI local ref table (has 512 entries)
It seems to be an Android specific problem with the local references in some JNI call not deleted. Unfortunately I can't test it on an iPhone.
Hello, What kind of elements are you adding? I tried adding 1000 labels, and it works fine on my device (Samsung Galaxy S2), as well as on the Emulator v4.0.3 and v2.3.3. There might be a memory issue, if you are adding complex elements to the view; can you post a sample code?
Hi, thanks for your reply. I thought about it being a memory issue as well, but in that case the JNI error seems a bit wierd. My setup is a bit more complicated as I add two labels and an image to the ScrollView 500+ times. However I also get this error when adding only labels. I am using the following code to add elements:
It has been simplified but I can confirm the above code not working neither on the 2.3.3 emulator nor on the 4.0.3 emulator. I am using Android SDK version 2.2.
Hello, I tested this issue with the test code below. I can’t reproduce this issue in Ti SDK 3.1.3GA. Please install the latest SDK and test your app. If you continue to get error, please send us a test case with steps to reproduce.
Testing Environment:
Ti CLI 3.3.0 Titanium SDK: 3.1.3.GA Android Device 2.3.3Test Code
app.jsSteps to Test
1. Create a new project 2. Update app.js file 4. And run this project with testing environmentExpected Result
550 rows will display on the screen Thanks