runtime: Log, DateTime.format, Input.text, Path, Mime, Fs, Os and Text keep nothing per call

Found by reading every builtin (Os.platform's 8 KB per call started it). Log builds its line only at
or above the threshold and frees it; DateTime.format folds through + so its pieces go; Input.text
encodes into one buffer; Path/Mime/Fs/Os free their temporaries on every path; string results of
Text/Path/Mime/DateTime/Os dirs are fresh and Text frees a fresh argument. Reseeded.
runtime_temps.ludic: 19.8 MB -> 0 over 20,000 rounds, 64 KB -> 0 over 200 of file work; clean under
MallocScribble. string_temps still 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 13:55:49 +03:00
parent 404ee2ee3b
commit 254097657e
11 changed files with 38168 additions and 37714 deletions

View file

@ -0,0 +1,14 @@
bump: patch
type: fix
**The runtime's text builtins keep nothing a call does not hand back.**
- `Log.*` builds nothing below the threshold (as documented) and frees the line it writes; a number
field's text and a made message go too. A `Log.debug` in a frame loop left its line every frame.
- `DateTime.format` frees each field's digits and each piece joined so far.
- `Input.text()` writes the typed text into one buffer instead of joining a string per character.
- `Path.stem` / `Path.normalize`, `Mime.of` / `Mime.sniff`, `Fs.write_text` / `copy` / `mkdir` and
`Os.save_dir` / `config_dir` / `cache_dir` free their working copies, on every way out.
- Every string `Text.*`, `Path.*`, `Mime.*`, `DateTime.format` and the `Os` directories return is
fresh, so a comparison, a `+` or a `print` that reads it frees it; a string made for a `Text` call's
argument (`Text.to_int(string(n))`) is freed once read.
`examples/lang/runtime_temps.ludic`: 20,000 rounds grew 19.8 MB before and 0 after; 200 rounds of
file work 64 KB before and 0 after.