Merge pull request 'Avoid wiping full error context on release' (#27) from 26 into main
All checks were successful
libakerror CI Build / cmake_build (push) Successful in 3m9s
libakerror CI Build / coverage (push) Successful in 11m41s
libakerror CI Build / mutation_test (push) Successful in 41m15s

Reviewed-on: #27
This commit was merged in pull request #27.
This commit is contained in:
2026-08-04 11:31:00 -04:00
committed by Starfort Source Vault
3 changed files with 48 additions and 11 deletions

View File

@@ -132,6 +132,11 @@ One recursive lock covers both the pool and the registry, so error
correctness there is worth more than throughput, but a program that raises
errors in a hot loop will feel it.
Releasing the last reference to a context remains serialized under that same
pool lock, but it now resets only the handled/status/reported state, the string
heads, and the stack-trace cursor. It no longer wipes the whole context buffer,
so release is a fixed handful of stores rather than a tens-of-kilobytes write.
The per-thread last-ditch context is a whole `akerr_ErrorContext` (tens of
kilobytes) in thread-local storage, allocated per thread on first use of the
library from that thread.