Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11675] Android V8 XML parsing fails

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-04-25T05:53:30.000+0000
Affected Version/sRelease 2.1.3
Fix Version/s2013 Sprint 09
ComponentsAndroid
LabelsCommunity, exalture
ReporterFederico Casali
Assigneejithinpv
Created2012-09-09T14:39:06.000+0000
Updated2017-03-21T22:01:23.000+0000

Description

Problem description

Parsing a large XML file fails using V8

Sample code and steps to reproduce

data.xml file is attached App.js :

var file = Ti.Filesystem.getFile('data.xml');
 
var xmlData = file.read().text;
 
var xml = Ti.XML.parseString(xmlData);
 
var nodes = xml.documentElement.childNodes;
 
var i, j, k;
 
for (i = 0; i < nodes.length; i++) {
        if (nodes.item(i).hasAttributes()) {
                var attr = nodes.item(i).getAttributes();
                for (j = 0; j < attr.length; j++) {
                        var nodeval = attr.item(j).nodeValue;
                        Ti.API.info(attr.item(j).nodeName + ': ' + nodeval);                   
                }
        }
        // <text>
        for (j = 0; j < nodes.item(i).childNodes.length; j++) {
                if (nodes.item(i).childNodes.item(j).nodeName == 'text') {
                        var textNodes = nodes.item(i).childNodes.item(j);
                        var text = "";
                        for (k = 0; k < textNodes.childNodes.length; k++) {
                                text += textNodes.childNodes.item(k).nodeValue;
                        }
                        Ti.API.info(text);
                }
        }
}
 
Ti.API.info("Success!");

win.open();
iOS and Rhino run just fine, but V8 fails before finishing with:
09-09 17:29:08.808: E/dalvikvm(4734): JNI ERROR (app bug): weak global reference table overflow (max=51200)
09-09 17:29:08.812: W/dalvikvm(4734): JNI weak global reference table (0x4d433008) dump:
09-09 17:29:08.816: W/dalvikvm(4734):   Last 10 entries (of 51200):
09-09 17:29:08.816: W/dalvikvm(4734):     51199: 0x419fa0f0 ti.modules.titanium.xml.ElementProxy
09-09 17:29:08.816: W/dalvikvm(4734):     51198: 0x41a01a78 ti.modules.titanium.xml.NodeListProxy
09-09 17:29:08.816: W/dalvikvm(4734):     51197: 0x41a06ec0 ti.modules.titanium.xml.ElementProxy
09-09 17:29:08.816: W/dalvikvm(4734):     51196: 0x41a10708 ti.modules.titanium.xml.NodeListProxy
09-09 17:29:08.816: W/dalvikvm(4734):     51195: 0x41a17080 ti.modules.titanium.xml.TextProxy
09-09 17:29:08.816: W/dalvikvm(4734):     51194: 0x41a1e348 ti.modules.titanium.xml.NodeListProxy
09-09 17:29:08.816: W/dalvikvm(4734):     51193: 0x41a237c0 ti.modules.titanium.xml.NodeListProxy
09-09 17:29:08.816: W/dalvikvm(4734):     51192: 0x41a2a308 ti.modules.titanium.xml.ElementProxy
09-09 17:29:08.816: W/dalvikvm(4734):     51191: 0x41a2d868 ti.modules.titanium.xml.NodeListProxy
09-09 17:29:08.816: W/dalvikvm(4734):     51190: 0x41a32178 ti.modules.titanium.xml.ElementProxy
09-09 17:29:08.901: W/dalvikvm(4734):   Summary:
09-09 17:29:08.901: W/dalvikvm(4734):      1844 of ti.modules.titanium.xml.TextProxy (1844 unique instances)
09-09 17:29:08.905: W/dalvikvm(4734):      4423 of ti.modules.titanium.xml.ElementProxy (4423 unique instances)
09-09 17:29:08.905: W/dalvikvm(4734):      4426 of ti.modules.titanium.xml.NodeListProxy (4426 unique instances)
09-09 17:29:08.905: W/dalvikvm(4734):       367 of ti.modules.titanium.xml.NamedNodeMapProxy (367 unique instances)
09-09 17:29:08.909: W/dalvikvm(4734):      2944 of ti.modules.titanium.xml.AttrProxy (2944 unique instances)

Basically it seems like the Java-side proxies are not getting properly deleted when JS-scoping says they should be.

Attachments

FileDateSize
data.xml2012-11-06T21:33:37.000+0000178814

Comments

  1. Federico Casali 2012-11-06

    Confirmed. Moving to TiMOB
  2. jithinpv 2013-04-25

    Cannot reproduce Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Android Emulator: Android SDK version: 2.2
  3. Lee Morris 2017-03-21

    Closing ticket as the issue cannot be reproduced and due to the above comments.

JSON Source