blaise/compiler
Graeme Geldenhuys 43a0f9e4eb fix(arc): release string call/getter transient passed to Write/WriteLn
A string-returning function, method or property getter used DIRECTLY as a
Write/WriteLn argument — WriteLn(GetBar) — returns a fresh +1 string that
_SysWriteStr only borrows.  EmitWrite emitted the write call but never released
that transient, leaking one string per call on BOTH backends.  (A normal
procedure's const-string parameter already released it; only the Write/WriteLn
built-in path was missing the release.  Assigning the result to a variable
first never leaked.)

EmitWrite now releases the string argument after the write when the argument
expression OWNS its reference (ExprOwnsRef / NativeExprOwnsRef) — a call or
concat result.  Plain variables, literals and PChars are borrowed and are not
released, so no double-free.  Native stashes the pointer across the
_SysWriteStr call and releases it after.

E2E regression (both backends, --debug leak tracker):
TE2ELeakCheckTests.TestDebug_WriteLnCallArg_NoLeak.
2026-06-28 00:47:53 +01:00
..
src fix(arc): release string call/getter transient passed to Write/WriteLn 2026-06-28 00:47:53 +01:00
project.xml refactor(rtl): relocate RTL units into the compiler tree (dotted-flat names) 2026-06-25 16:05:44 +01:00