-
-
Notifications
You must be signed in to change notification settings - Fork 819
Closed
Labels
performanceIssue related to performance problems or enhancementsIssue related to performance problems or enhancements
Milestone
Description
Adding https://github.com/nst/JSONTestSuite in rallyhealth/weePickle#106 uncovered that JsonPointer
memory usage is quadratic over depth. -Xmx8g
is insufficient to create a JsonPointer
for 100k opening arrays without an OutOfMemoryError
.
JsonPointer
seems to be a linked list where each node contains an _asString
field containing the full path to that node.
Minimal test to repro the issue: 3764ff4
// such as https://github.com/nst/JSONTestSuite/blob/master/test_parsing/n_structure_100000_opening_arrays.json
public void testDeepJsonPointer() throws Exception {
int DEPTH = 100000;
String INPUT = new String(new char[DEPTH]).replace("\0", "[");
JsonParser parser = createParser(MODE_READER, INPUT);
try {
while (true) {
parser.nextToken();
}
} catch (Exception e) {
JsonStreamContext parsingContext = parser.getParsingContext();
JsonPointer jsonPointer = parsingContext.pathAsPointer(); // OOME
String pointer = jsonPointer.toString();
String expected = new String(new char[DEPTH - 1]).replace("\0", "/0");
assertEquals(expected, pointer);
}
}
Metadata
Metadata
Assignees
Labels
performanceIssue related to performance problems or enhancementsIssue related to performance problems or enhancements