A DESCRIPTION OF THE REQUEST :
The current implementation of StAX does not split large CDATA strings into smaller components, thus chewing up memory on extremely large strings. This issue causes extreme performance lags.
JUSTIFICATION :
This enhancement is necessary because the greater speed and lower memory use gained by changing it. Also, as it only applies to very large strings, it won't affect many users and will be extremely helpful to those who do use large strings.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
See patch in workaround.
Basically splits up CDATA to make memory load easier and thus increase speed while passing these guys around.
ACTUAL -
Doesn't split up CDATA, huge memory load on large strings, thus, slow.
CUSTOMER SUBMITTED WORKAROUND :
Patch
diff -Naur old/MXParser.java new/MXParser.java
--- old/MXParser.java 2008-07-24 09:19:17.843750000 -0400
+++ new/MXParser.java 2008-07-24 09:18:53.984375000 -0400
@@ -1852,11 +1852,17 @@
normalizedCR = false;
}
}
+ posEnd = pos;
+
+ long textLen = usePC ? (pcEnd - pcStart) : (posEnd - posStart);
+
+ if( textLen > 10*1024 )
+ return eventType = XMLStreamConstants.CHARACTERS;
ch = more();
} while(ch != '<' && ch != '&');
posEnd = pos - 1;
continue MAIN_LOOP; // skip ch = more() from below - we are alreayd ahead ...
- }
+ }
ch = more();
} // endless while(true)
} else {
The current implementation of StAX does not split large CDATA strings into smaller components, thus chewing up memory on extremely large strings. This issue causes extreme performance lags.
JUSTIFICATION :
This enhancement is necessary because the greater speed and lower memory use gained by changing it. Also, as it only applies to very large strings, it won't affect many users and will be extremely helpful to those who do use large strings.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
See patch in workaround.
Basically splits up CDATA to make memory load easier and thus increase speed while passing these guys around.
ACTUAL -
Doesn't split up CDATA, huge memory load on large strings, thus, slow.
CUSTOMER SUBMITTED WORKAROUND :
Patch
diff -Naur old/MXParser.java new/MXParser.java
--- old/MXParser.java 2008-07-24 09:19:17.843750000 -0400
+++ new/MXParser.java 2008-07-24 09:18:53.984375000 -0400
@@ -1852,11 +1852,17 @@
normalizedCR = false;
}
}
+ posEnd = pos;
+
+ long textLen = usePC ? (pcEnd - pcStart) : (posEnd - posStart);
+
+ if( textLen > 10*1024 )
+ return eventType = XMLStreamConstants.CHARACTERS;
ch = more();
} while(ch != '<' && ch != '&');
posEnd = pos - 1;
continue MAIN_LOOP; // skip ch = more() from below - we are alreayd ahead ...
- }
+ }
ch = more();
} // endless while(true)
} else {