stanfordnlp/CoreNLP · critical · RuntimeException
CANNOT EVEN CREATE ARRAYS OF ORIGINAL SIZE!!!
Error message
CANNOT EVEN CREATE ARRAYS OF ORIGINAL SIZE!!!
What it means
After a failed attempt to grow chart arrays for a longer sentence, ExhaustiveDependencyParser.parse tries to recreate arrays at the previous working size (arraySize). If even that allocation fails with OutOfMemoryError, it throws RuntimeException 'CANNOT EVEN CREATE ARRAYS OF ORIGINAL SIZE!!! <arraySize>' — the JVM heap is too exhausted to restore the parser's prior state.
Solutions
- Increase JVM heap (-Xmx), e.g. -Xmx4g or more depending on grammar size and maxLength
- Reduce testOptions.maxLength to keep chart arrays smaller
- Run parsing in a fresh JVM or ensure prior parses/objects are garbage-collectable
Example fix
// before java -Xmx1g ... Parser -maxLength 100 ... // after java -Xmx8g ... Parser -maxLength 60 ...
Defensive patterns
Strategy: try-catch
Validate before calling
long maxHeap = Runtime.getRuntime().maxMemory(); if (maxHeap < requiredHeapForGrammar) throw new IllegalStateException("Increase -Xmx; heap " + maxHeap + " too small for parser chart"); Try / catch
try { parser.parse(sentence); } catch (RuntimeException e) { if (e.getMessage().startsWith("CANNOT EVEN CREATE ARRAYS")) { reduceMaxLengthAndRetryOrRestartJvm(); } } Prevention
- Size -Xmx generously for the grammar plus O(n^2) charts
- Avoid retaining prior parse results; run long batch jobs with periodic JVM restarts
- Lower maxLength so array reallocation succeeds even on failure paths
When it happens
Trigger: parse() called with a long sentence; growing arrays OOMed; the fallback createArrays(arraySize) also threw OutOfMemoryError — i.e., heap is nearly full at the original chart size.
Common situations: Parsing many long sentences in one JVM without releasing memory; -Xmx too small for the grammar/chart; memory leaks from retaining previous parses.
Related errors
- Refusal to create such large arrays.
- CANNOT EVEN CREATE ARRAYS OF ORIGINAL SIZE!!
- Parsing of sentence failed, possibly because of out of…
- Attempt to create ChineseSimWordAvgDepGrammar before…
- Attribute already defined:
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/74149c935a798f77.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/parser/lexparser/ExhaustiveDependencyParser.java:189
public boolean parse(List<? extends HasWord> sentence) {
if (op.testOptions.verbose) {
Timing.tick("Starting dependency parse.");
}
this.sentence = sentence;
int length = sentence.size();
if (length > arraySize) {
if (length > op.testOptions.maxLength + 1 || length >= myMaxLength) {
throw new OutOfMemoryError("Refusal to create such large arrays.");
} else {
try {
createArrays(length + 1);
} catch (OutOfMemoryError e) {
myMaxLength = length;
if (arraySize > 0) {
try {
createArrays(arraySize);
} catch (OutOfMemoryError e2) {
throw new RuntimeException("CANNOT EVEN CREATE ARRAYS OF ORIGINAL SIZE!!! " + arraySize);
}
}
throw e;
}
arraySize = length + 1;
if (op.testOptions.verbose) {
log.info("Created dparser arrays of size " + arraySize);
}
}
}
if (op.testOptions.verbose) {
log.info("Initializing...");
}
// map to words
words = new int[length];
int numTags = dg.numTagBins();//tagIndex.size();
//System.out.println("\nNumTags: "+numTags);View on GitHub (pinned to 1b7edd19c4)