Artifact 1b7fbc343e06a5b4fd8bf8ff5a2eeb98b8b8445f8b85020e38d7ccf1827fa0c6:
- File typeparse/noyau/ORDRE.txt — part of check-in [d03339047e] at 2026-10-23 11:38:18 on branch tip-764_tcl90 — Addressing "lset leak via TclLsetList (Claude)" Shared a file, used Claude Docs, executed 29 commands. The `lset` leak has been fixed (v15o, in `typeparse.zip`). Along the way, I also corrected a type-loss issue in `lpop` and a minor leak occurring during the management of typed variables. The leak was more extensive than anticipated. It affected any `lset` operation targeting a single index within a typed list—such as the common case `lset L 0 9`, whether compiled or not—resulting in a leak of approximately 170 bytes per call (17 MB over 100,000 calls in v15). The root cause lies within Tcl 9.0 itself. The core lacks a consistent convention regarding the reference returned by an abstract list’s `setElementProc`: * `TclLsetList` (used for `lset L 0 9` and `lset L {0} 9`) as well as uncompiled `lset` operations with multiple indices add a reference; therefore, the returned value must not carry an additional reference. * `INST_LSET_FLAT` (for compiled `lset M 0 1 9`) and `lpop L i` use the value as-is, implying it must already carry a reference. Our `AnnotListSetElement` followed the second convention, which caused the leak. I initially attempted the reverse—aligning the core with our approach—but Tcl’s own test abstract list follows the first convention, causing `abstractlist.test` to crash. The fix: adopting a single convention—the first one. * `AnnotListSetElement` now returns the value without an added reference. * `INST_LSET_FLAT` and `lpop` (with indices) now add the reference they expect to be present. Also discovered (and already present in v15): * `lpop L` (without an index) caused the variable to lose its type; `type get $L` would return empty. It would modify the value of a typed list in place; the variable would then hold an untyped value, effectively losing its contract. A typed list is now copied before any modification, consistent with the behavior of `lset`. There was a minor memory leak during the handling of a retyped value (`tclVar.c`): when a value—arriving without a reference—was replaced by its retyped version, the original value was never freed. Additionally, an improperly targeted cleanup operation occurred in the same section: if a contract was rejected, the code would target the intermediate value instead of the caller’s original value. Tests against v15: The new test `t68_lset_reference` measures memory usage (Linux only; it reports "no /proc" on other systems). In v15, it showed a leak in four scenarios, as well as a type loss during `lpop`; now, there are no leaks or type losses. The project's tests and examples show no new differences compared to v15, and all `.out` outputs pass. The Tcl test suites—`lset*`, `lpop`, `list*`, `cmdIL`, `abstractlist`, `lseq`, `set*`, `var`, `upvar`, `append*`, `incr*`, and `trace`—result in 1,903 passes, 84 skips, and zero failures, exactly as in v15. `valgrind` shows no issues. (user: Florentis, size: 1047) [annotate] [blame] [check-ins using]
# Patchs C à appliquer sur l'arbre, dans cet ordre (un par ligne, # = commentaire). # maj.sh détecte seul ceux qui sont déjà appliqués. Les nouveaux patchs s'ajoutent à la fin. # C patches to apply to the tree, in this order. maj.sh detects the ones already applied. types-binaires-linkdepth.patch types-binaires-referentiel.patch types-binaires-taille-dynamique.patch types-binaires-annotations-locales.patch types-binaires-type-binary-annote.patch types-binaires-nom-type-binary.patch types-binaires-set-annotation-locale.patch types-binaires-notes.patch types-binaires-notes-typeget.patch types-binaires-cast-constructeur.patch types-binaires-convert-famille.patch types-binaires-codec-c.patch types-binaires-codec-c-decode.patch types-chemins-construction.patch types-chemins-depliage.patch index-chemins-noyau.patch types-chemins-atomes.patch types-produit-etiquettes.patch contrat-par-nom.patch elements-atomiques.patch cast-collection.patch eias-string-is.patch chemins-modification.patch set-nom-substitue.patch lset-reference.patch