mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-28 19:57:05 -06:00
One Repeat makes at most 250,000 instances (a 500 x 500 grid; radial counts stop at 1,000), but its source may hold another Repeat and every instance draws that one again: expand() clones the inner Repeat once per instance, and the renderer, the exporters (expand_deep) and hit testing evaluate each copy. Nothing bounds the product, so a document under 1 KB with a 500 x 500 grid of a 500 x 500 grid asks for 62.5 billion instances: opening it freezes the app or runs it out of memory, and the unsaved work in other documents is lost with it. A Repeat now counts the instances the Repeats nested in its source make in all and keeps only as many of its own as fit in 250,000, the budget pattern fills already keep (at least one, so the source still shows). A Repeat with nothing nested keeps all its instances, as before. The test nests a 500 x 500 grid in a 500 x 500 grid and in a mirror, counts the instances from the transforms (62.5 billion before) and checks they stay within the budget, while one grid and a small nest keep all of theirs. Reported-by: BS.ehlas.cz