stanfordnlp/CoreNLP · critical · RuntimeException
CANNOT EVEN CREATE ARRAYS OF ORIGINAL SIZE!!
Error message
CANNOT EVEN CREATE ARRAYS OF ORIGINAL SIZE!!
What it means
When createArrays for the requested sentence length fails with OutOfMemoryError, the parser attempts to restore its previous array size (arraySize). If even that fails, it throws this RuntimeException, meaning the heap is too small to recreate the parser's original chart arrays — internal state may be broken.
Solutions
- Increase JVM heap (e.g. -Xmx4g or more) so chart arrays can be allocated.
- Lower op.testOptions.maxLength so the parser refuses earlier and never attempts the huge reallocation.
- Avoid reusing the parser after this error; reload the parser in a larger-heap environment.
Example fix
// before java -Xmx1g -cp stanford-parser.jar ... parser.parse(longSentence); // after java -Xmx8g -cp stanford-parser.jar ... op.testOptions.maxLength = 60;
Defensive patterns
Strategy: try-catch
Validate before calling
// ensure generous heap before constructing long-sentence parses
long maxHeap = Runtime.getRuntime().maxMemory();
if (maxHeap < 2L * 1024 * 1024 * 1024 && sentence.size() > 100) throw new IllegalStateException("insufficient heap for long parse"); Try / catch
try { pq.parse(sentence); } catch (RuntimeException e) { if (e.getMessage().contains("CANNOT EVEN CREATE ARRAYS")) { reloadParserWithLargerHeap(); } else throw e; } Prevention
- Run the parser with a large -Xmx sized to maxLength (chart memory grows cubically).
- Avoid reusing a parser instance after an OutOfMemoryError; reload it.
- Enforce maxLength caps before parsing so the huge reallocation is never attempted.
When it happens
Trigger: A parse request triggers reallocation to a larger sentence length; allocation fails; the fallback createArrays(arraySize) also throws OutOfMemoryError due to insufficient heap.
Common situations: Running the parser with a small -Xmx heap and then feeding a long sentence that grows the chart; memory already consumed elsewhere; container memory limits.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- attempt to get word when sentence and lattice are null!
- Bad number put into wordToNumber. Word is: \"" + input +…
- Bad number put into wordToNumber. Word is: \"" + curPart +…
- Can't return head of null or leaf Tree.
- CANNOT EVEN CREATE ARRAYS OF ORIGINAL SIZE!!!
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/265c335fed4406c3.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/parser/lexparser/ExhaustivePCFGParser.java:2197
}
} catch (OutOfMemoryError oome) {
oome.printStackTrace();
}
}
private void considerCreatingArrays(int length) {
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!!");
}
}
throw e;
}
arraySize = length + 1;
if (op.testOptions.verbose) {
log.info("Created PCFG parser arrays of size " + arraySize);
}
}
}
protected void createArrays(int length) {
// zero out some stuff first in case we recently ran out of memory and are reallocating
clearArrays();
int numTags = tagIndex.size();
// allocate just the parts of iScore and oScore used (end > start, etc.)
// todo: with some modifications to doInsideScores, we wouldn't need to allocate iScore[i,length] for i != 0 and i != lengthView on GitHub (pinned to 1b7edd19c4)