mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-14 14:32:02 +08:00
A released region that something outside still refers to is kept, and SCRIPTC_REGION_STATS only said how many references the walk could not explain. In a build with --optimization=dev (or --sanitize), setting SCRIPTC_REGION_DEBUG=1 (or a larger number, the line limit) makes each attempt that keeps a region also print what keeps it: - per chunk, the references to its objects that the walk did not find (from variables, other regions or objects it does not walk), with the classes the chunk holds, since counts are kept per chunk; - each ordinary object the region owns that is referenced from outside, named by the region class and field it was reached through, with its reference count and the references the walk found. The emitted region class descriptors gain the names of the fields their visits report, in visit order. Debug walks give every owned object an entry, so that each one records where the walk first reached it. The bookkeeping is compiled only into unoptimized and RC-audit runtimes: compiled in, it made the release walk 6.5% slower even with the variable unset. Optimized runtimes walk as before and, when the variable is set, say once that the reports need a dev build. Retains, releases and allocation are unchanged. Adds corpus program 5703.