Parsing JSON with lots of large numeric keys can throw an OOM. http://stackoverflow.com/questions/32787100/nashorn-json-parse-java-lang-outofmemoryerror-java-heap-space-jdk8u60 The problem is that we don' switch to sparse array data soon enough. The current threshold (defined in SparseArrayData.MAX_DENSE_LENGTH) is 8 * 1024 * 1024.