Skip to content

ThreadLocal reuses a slot without clearing its old values #68

Closed

Description

@dimensionscape

hx::thread::ThreadLocal (used by the Haxe 5 std Tls) recycles a slot id when its Tls is collected, but the values stored in that slot on each thread are never cleared. A new Tls that gets the recycled id reads the old owner's value, and that value stays alive until it is overwritten. The legacy __hxcpp_tls_* ids and ThreadLocal ids also both start at 0 and index the same per-thread array.

Related: HaxeFoundation/haxe#12967 (eval frees Tls values when the Tls dies).

Activity

  1. added this to the 6.0.0 milestone on Oct 15, 2026
  2. added a commit that references this issue on Oct 15, 2026
    6abef5c
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions