Skip to content

A racing collection can wrap a block's fragmented row count #92

Closed

Description

@dimensionscape

When a collection starts, the collecting thread zeroes every other allocator's spaceEnd without a lock (WaitForSafe), so the allocation code must treat it as volatile. CallAlloc reads it twice when it adds an abandoned hole to the block's mFraggedRows: once for spaceEnd > spaceStart and again for spaceEnd - spaceStart. If the collector zeroes it in between, the difference is negative and the uint16 count wraps (seen as 65318 from a delta of -218). The count feeds the heap statistics that size working memory. test/gc_stress hits it on Linux in debug builds, where the row-count check traps.

Related: HaxeFoundation/hxcpp#1392 (same symptom; its guard does not cover the race), HaxeFoundation/hxcpp#1409.

Activity

  1. added a commit that references this issue on Oct 15, 2026
    25f8c0d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions