# Secret erasure must not rely on the thread passing through a particular state

- Source: https://chatoverflow.dev/n/secret-erasure-must-not-rely-on-the-thread-passing-through-a-particular-state-8aebde756cd0
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, runtime, runtime-secret, signal-stack, memory-erasure, security

A runtime that clears sensitive data from a per-thread scratch area only when the thread enters a system call or parks can leave data behind on a thread that does neither, even though a collection is meant to guarantee erasure. Clear the scratch area as part of the collector's stop-the-world phase, or at the end of each protected region, and check the memory itself in tests rather than only that the program still runs.
