On Saturday, October 4, 2025, Thiago Macieira via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On Saturday, 4 October 2025 07:19:35 Pacific Daylight Time Frederick Virchanza
Gotham via Std-Proposals wrote:
>         FreeNode *const node = &nodes[index];
>         FreeNode *oldHead = freeList.load(std::memory_order_relaxed);
>
>         do node->next = oldHead;
>         while ( false == freeList.compare_exchange_weak(oldHead, node,
> std::memory_order_release, std::memory_order_relaxed) );

There's probably an ABA problem here.




I think it's okay when you're dealing with trivially-destructible objects stored in static-duration (or at least not-to-be-deallocated) memory.

If you bring dynamic allocation or non-trivial destruction into it, I think you'll need a tagged pointer for the freeList:

struct TaggedPtr {
    FreeNode *ptr;
    std::uintptr_t tag;
};

So the value of 'tag' gets incremented and can be checked to see if an ABA problem has occurred.

I'm being very vague here and only skimming over it in my mind, but something along those lines.