Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/spec/changelog/2026-07-20.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@

Feature additions and fixes recorded during this week.

### Fixed

- **`$MaxExtraPrecision` init leak** (beads-planning-dbl). The inline
`$MaxExtraPrecision` registration block in `system_constants_init`
(`src/core.c`) passed an `expr_new_real(50.0)` temporary to
`symtab_add_own_value` without freeing it — a 64-byte `EXPR_REAL` leak at
startup (`symtab_add_own_value` deep-copies its replacement, so the caller
retains ownership of its own reference). Fixed by capturing the value in a
local and `expr_free`-ing it, mirroring the `register_system_constant` helper.
macOS `leaks` on `trace_tests` now reports 0 leaks (was "1 leak for 64 total
leaked bytes" rooted at `system_constants_init -> expr_new_real`).

## Numeric loop fast-path + iteration allocation cleanups (2026-07-20)

Closed the large gap to Mathematica on tight numeric loops. Reference (10^6
Expand Down
4 changes: 3 additions & 1 deletion src/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,10 @@ static void system_constants_init(void) {
* other constants it is user-settable, so it is NOT marked Protected. */
{
Expr* sym = expr_new_symbol(SYM_DollarMaxExtraPrecision);
symtab_add_own_value("$MaxExtraPrecision", sym, expr_new_real(50.0));
Expr* val = expr_new_real(50.0);
symtab_add_own_value("$MaxExtraPrecision", sym, val);
expr_free(sym);
expr_free(val);
}
register_system_constant("$MachineEpsilon", expr_new_real(DBL_EPSILON));
register_system_constant("$MinMachineNumber", expr_new_real(DBL_MIN));
Expand Down