Skip to main content

release_core_state_for_post

Function release_core_state_for_post 

Source
pub fn release_core_state_for_post()
Expand description

Release the TeX engine’s thread-local state (STATE, STOMACH, GULLET, StringInterner arena, and per-conversion caches) after MakeBibliography completes and before the render phases (parallel_render, CrossRef, Graphics, MathML, XSLT), while keeping REPORT (including undefined/missing macro/file tallies), LOGGER, telemetry, and watchdog/deadline limits intact.

On a large split book, dead core engine state can retain gigabytes in the parent process throughout post-processing, starving parallel_render’s worker memory budget (RENDERFLEETBIG).

Safety / ordering contract:

  1. Call ONLY after MakeBibliography finishes — MakeBibliography reads virtual .bib files (VFS_KEY) and runs recursive .bib digestion against live STATE (author preamble macros and lx@bibliography@normalfont, OD #779).
  2. Call ONLY in a one-shot process/thread that will NOT re-enter the TeX engine afterward (see the reuse contract on reset_thread_engine).