Skip to main content

reset

Function reset 

Source
pub fn reset()
Expand description

Free every interned string on this thread, returning the arena to a fresh, empty state.

Danger: this invalidates every outstanding SymStr on the thread — they become dangling indices that may resolve to unrelated strings after re-interning. It is only sound when nothing on the thread will read a pre-reset SymStr again: i.e. between fully independent conversions in a reused process (the test harness, where each test has already serialized its output to owned Strings and the thread is about to exit or be re-initialized) or a future daemon that re-initializes the engine afterward. The single-conversion latexml_oxide binary never calls this — it exits instead.

Needed because the engine’s roots are #[thread_local] attribute statics, which (unlike the thread_local! macro) do not run destructors on thread exit. Without an explicit reset, every reused thread leaks its interner (~tens of MB for a full document). See latexml_core::reset_thread_engine.