Skip to content

Open source CapCut alternative.

TypeScript

docs: the memory ceiling is a quarter of the machine

David Le9e7b92ebc70f
diff --git a/docs/guides/cut/README.md b/docs/guides/cut/README.md
index ca53a3b0..812d371c 100644
--- a/docs/guides/cut/README.md
+++ b/docs/guides/cut/README.md
@@ -62,7 +62,7 @@ Some machines cannot decode the footage as fast as it plays, and no reader can i
Decoders live in a bounded pool, and leaving the pool is suspension before it is closure: an idle source gives up its decoder but keeps the parsed file and the canvases its frames land on, so the next visit wakes it for the cost of one keyframe seek. The canvases are the part that must not churn — a montage of short clips replayed for a few minutes, allocating a fresh set on every reopen, floods the GPU process until frames stop arriving at all. They also must not pile up, so the warm shelf of stood-down sources is capped by the memory it holds rather than by a count of them: a small stage keeps a montage's whole cast, a large one keeps a few, and what does not fit closes for real. A file that moves to a new address mid-play — an import landing in project storage, a signed link re-minted ahead of expiry — keeps its source: the frames already decoded carry the picture while a fresh reader opens on the new address behind them, and the walk goes on from wherever the playhead stands. Closing there instead would put a cold open in front of the very next frame, and the picture would freeze for exactly as long as the open takes.
-Those caps are shares of one number. A cut is built out of expensive pictures — frames held inside the platform's decoder, canvases behind every source the pool keeps warm, the bytes of the files they were decoded from — and each of those was capped in whatever currency its own subsystem thought in: a count of decoders, a number of pixels, a number of open files. The tab's real ceiling was whatever those happened to add up to on the machine the tuning was done on. Now every cache says what it holds in bytes and asks what it may hold, and the answer is the smaller of the size it was tuned to want and its share of an eighth of the machine's memory. Where there is room the tuned size is the smaller one and the preview behaves as it was tuned to. Where there is not, the share binds first and every cache sheds together. Which caches stand in a share, and how much of it each may stand on, is written in that one place as well, so two caches cannot be handed the same room and a cache that only reports what it holds still has room set aside for it. File bytes are the share the tab itself stands on, and they are held once. A file is opened once for the tab: a cut of forty segments from one recording has forty sources, and they share the one parsed file and its reader cache, each holding only its own decoder and canvases; the voices and the filmstrip's readers join the same open file. Under that, every read of a cloud file goes through one chunk memory, and a reader keeps for itself only the few megabytes its own walk is standing on. A file addressed by the page's own route, while it has no signed link, reads through the same store, since the route redirects to the object the store keys on; a cut shared with someone reads through the share's route the same way, so a viewer holds the file once the way its owner does.
+Those caps are shares of one number. A cut is built out of expensive pictures — frames held inside the platform's decoder, canvases behind every source the pool keeps warm, the bytes of the files they were decoded from — and each of those was capped in whatever currency its own subsystem thought in: a count of decoders, a number of pixels, a number of open files. The tab's real ceiling was whatever those happened to add up to on the machine the tuning was done on. Now every cache says what it holds in bytes and asks what it may hold, and the answer is the smaller of the size it was tuned to want and its share of a quarter of the machine's memory. Where there is room the tuned size is the smaller one and the preview behaves as it was tuned to. Where there is not, the share binds first and every cache sheds together. Which caches stand in a share, and how much of it each may stand on, is written in that one place as well, so two caches cannot be handed the same room and a cache that only reports what it holds still has room set aside for it. File bytes are the share the tab itself stands on, and they are held once. A file is opened once for the tab: a cut of forty segments from one recording has forty sources, and they share the one parsed file and its reader cache, each holding only its own decoder and canvases; the voices and the filmstrip's readers join the same open file. Under that, every read of a cloud file goes through one chunk memory, and a reader keeps for itself only the few megabytes its own walk is standing on. A file addressed by the page's own route, while it has no signed link, reads through the same store, since the route redirects to the object the store keys on; a cut shared with someone reads through the share's route the same way, so a viewer holds the file once the way its owner does.
The ceiling is a model. The memory that runs a machine out is memory a page cannot see — decoded frames sit inside the platform's decoder, canvas backing sits in the GPU process, and the browser reports the size of neither — so the counting happens at the allocation sites, where the sizes are known exactly. What the browser does report is roughly how much memory the machine has, which is enough to tell a laptop from a workstation.