Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-15765

Android: TableView - JNI ERROR (app bug): local reference table overflow (max=512)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 3.1.3
    • Fix Version/s: Release 6.0.0, Release 5.4.0
    • Component/s: Android
    • Environment:

      Titanium SDK 3.1.3GA
      Android API 4.0 [armeabi-v7a]
      Windows 7 Pro 64-bit

    • Story Points:
      8
    • Sprint:
      2016 Sprint 15 SDK

      Description

      Problem Description

      This code recreates it. Dies with error : "[ERROR][dalvikvm( 840)] JNI ERROR (app bug): local reference table overflow (max=512)"

      Test case

      //Set the number of table rows for this test
      var numberOfTableRowsToTest = 50;
       
       
      var vAnswerTable = Ti.UI.createTableView({
         backgroundColor:'#FFFFFF',
         data: [Ti.UI.createTableViewRow({title:'Loading...'})],
         top: 50,
         left: 0
       
      });
       
      if(numberOfTableRowsToTest < 5){
       
          numberOfTableRowsToTest = 5;
      } 
       
      var numOfQuestions = numberOfTableRowsToTest / 5;
      var numOfAnswers = numOfQuestions * 4;  
      var sections = [];
       
      for (var i=0;i<numOfQuestions;i++) {  //Loop over questions array
       
              //Question Variables from DB. 
              var questionID = "questionID"+i;
              var question = "Question Content "+i;
              var position = "question position"+i;
       
              //answersArr = questionsArr[i].answersArr; //Answers array. Contains all answer data for this question from DB.
       
              //Create the table section for each Question. Each question plus its answers is a section. 
              var questionTableSection = Ti.UI.createTableViewSection({
                  id:i
              });
       
              //Create the table row for questions. 
              var questionRow = Ti.UI.createTableViewRow({
                         //name: "questionRow"+questionID,    
                         name: "questionRow",
                         title: "\n"+(i + 1)+". "+question,
                         font:{fontWeight:'bold',fontSize:25},
                         color:'#000000',
                         touchEnable: false,
                         selectionStyle:'none'
       
              });  
       
              questionTableSection.add(questionRow);//Add the question row to the table section
       
       
       //BOF: Loop over all of the answers for this question. 
              for (var z=0;z<numOfAnswers;z++) {
       
                  //Answer Variables from DB. 
                  var answerID = "answerID"+z;
                  var answerPosition = "answer position"+z;
                  var answerContent = "content"+z;
       
       
                  //Create the row for this answer.
                  var answerRow = Ti.UI.createTableViewRow({
                          id: answerID,
                          height: 75,
                          color:'#000000',
                          questionID: 1+z,
                          sectionID: i, //The number of the current section. Used in click event to determine what section the click happened in.
                          rowID: z      
                  });
                  //Ti.API.info("Answer Row Created"); 
                  //Create the label for displaying the question. 
                  var lAnswer = Ti.UI.createLabel({
                      text: answerContent,
                      textAlign: "left",
                      left:0
                  });
                  //Ti.API.info("Answer Label Created");
       
       
                  //Add the answer label to the answer row.
                  answerRow.add(lAnswer); 
                  //Ti.API.info("Add Answer label to answer row");
       
                  //Add the answer row to this the table section
                  questionTableSection.add(answerRow);
                  //Ti.API.info("Add answer row to question table section");
       
              }//EOF: Loop over all of the answers for this question. 
       
          sections.push(questionTableSection);    
       
       } 
       
       //Add the sections created above to the table view
       vAnswerTable.setData(sections);
       
       
       
      for(var i = 0; i < vAnswerTable.data.length; i++){
       
          Ti.API.info("Error here after "+i+" itteratopns outer loop, current section"+ vAnswerTable.data[i]); 
       
              for(var k = 0; k < vAnswerTable.data[i].rowCount; k++) {
                  Ti.API.info("Error here after "+k+" itteratopns inner loop, "+i+" itterations Outter loop current section row"+  vAnswerTable.data[i].rows[k]); 
              }
       
      }

      Extra information (output of the code)

      OUTPUT:

      [INFO][TiAPI ( 840)] Error Hear after 0 itteratopns outer loop, current section[object TableViewSection] [INFO][TiAPI ( 840)] Error Hear after 0 itteratopns inner loop, 0 itterations Outter loop current section row[object TableViewRow] [INFO][TiAPI ( 840)] Error Hear after 1 itteratopns inner loop, 0 itterations Outter loop current section row[object TableViewRow] [INFO][TiAPI ( 840)] Error Hear after 2 itteratopns inner loop, 0 itterations Outter loop current section row[object TableViewRow]

      Conversation in the Q&A

      Thread Reference: http://developer.appcelerator.com/question/158112/reference-table-overflow-on-select-all-for-tableview-android#comment-193627

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cwilliams Christopher Williams
                Reporter:
                thebrownsys Beau
                Reviewer:
                Ashraf Abu (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-17859
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code