diff --git a/wcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/ChunkParser.java b/wcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/ChunkParser.java index af389f555..6626c9298 100644 --- a/wcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/ChunkParser.java +++ b/wcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/ChunkParser.java @@ -738,6 +738,15 @@ private void processLineChunk(BoundingBox boundingBox, Long mcid, LineChunk line lineArtContainer.add(mcid, lineChunk, operatorIndex, xObjectName); if (StaticStorages.getIsIgnoreMCIDs()) { boundingBox.union(lineChunk.getBoundingBox()); + // The line carries only the operator that painted it. The region's + // full list goes once onto the LineArtChunk that processLineArts + // builds, whose box holds the line, and a consumer that needs the + // whole region finds that chunk through this operator and that box. + // Giving every line the full list cost lines x operators objects: one + // chart of 7,500 strokes made 56 million and ran out of heap. + if (StaticContainers.isDataLoader()) { + lineChunk.getStreamInfos().add(new StreamInfo(operatorIndex, xObjectName, null)); + } } } @@ -1161,11 +1170,8 @@ public void processLineArts() { List pending = lineArtContainer.getStreamInfos(null); List lineChunks = lineArtContainer.getLineChunks(null); if (lineChunks != null && !lineChunks.isEmpty()) { - for (LineChunk lineChunk : lineChunks) { - for (StreamInfo info : pending) { - lineChunk.getStreamInfos().add(new StreamInfo(info)); - } - } + // Each line already holds its own operator (processLineChunk). The + // region's list is attached to the boxes below only, once per box. artifacts.addAll(lineChunks); lineChunks.clear(); }