Repository navigation
fix(example): fix mem step-2-gc shutdown abort (#383) - #386
Merged
gg582 merged 2 commits intoOct 17, 2026
Merged
Conversation
cwist_alloc() does not produce TTAK-headered memory, so passing its output to cwist_reg_ptr_sized() and then calling cwist_gc_shutdown() (which runs ttak_epoch_gc_destroy) triggers TTAK header validation and aborts with "TTAK Memory Corruption detected (Header corrupted)". The correct paired pattern for deferred, epoch-safe release is cwist_ebr_alloc() + cwist_ebr_free() + cwist_gc_pipeline_tick(), which does not pass ownership to ttak_epoch_gc_destroy. The example is rewritten to use that pattern. cwist_gc_t is kept in the example to demonstrate cwist_gc_auto_rotate() and cwist_gc_shutdown() on a context with no registered pointers, which shuts down cleanly. Verified: the original main.c aborts at cwist_gc_shutdown(); the rewritten version exits at "Done" with status 0.
gg582
added a commit
that referenced
this pull request
Oct 17, 2026
cwist_alloc() does not produce TTAK-headered memory, so passing its output to cwist_reg_ptr_sized() and then calling cwist_gc_shutdown() (which runs ttak_epoch_gc_destroy) triggers TTAK header validation and aborts with "TTAK Memory Corruption detected (Header corrupted)". The correct paired pattern for deferred, epoch-safe release is cwist_ebr_alloc() + cwist_ebr_free() + cwist_gc_pipeline_tick(), which does not pass ownership to ttak_epoch_gc_destroy. The example is rewritten to use that pattern. cwist_gc_t is kept in the example to demonstrate cwist_gc_auto_rotate() and cwist_gc_shutdown() on a context with no registered pointers, which shuts down cleanly. Verified: the original main.c aborts at cwist_gc_shutdown(); the rewritten version exits at "Done" with status 0. Co-authored-by: 이윤진(Lee Yunjin) <168180007+gg582@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
example/mem/step-2-gc/main.c crashes on every run at cwist_gc_shutdown() because cwist_alloc()-allocated pointers are passed to cwist_reg_ptr_sized(). At shutdown, ttak_epoch_gc_destroy() runs header validation over the registered pointers. cwist_alloc() does not produce TTAK-headered memory, so the validation aborts with the fatal message reported in issue #383.
What this changes: main.c is rewritten to use cwist_ebr_alloc() + cwist_ebr_free() + cwist_gc_pipeline_tick() -- the correct paired pattern for epoch-based deferred release. cwist_gc_t is kept in the example to demonstrate cwist_gc_auto_rotate() and cwist_gc_shutdown() on a context with no registered pointers, which shuts down cleanly.
How it was verified: the original main.c aborts at the cwist_gc_shutdown() call, confirmed against the repro in issue #383. The rewritten version exits at "Done" with status 0.
What it does not do: does not change the cwist_reg_ptr or cwist_gc_shutdown implementation; the library-side fix is a separate concern.