Jinoh Kang (@iamahuman) commented about dlls/ntdll/heap.c:
+ BOOL enable = FALSE; + + if (bin == heap->bins && alloc > 0x10) enable = TRUE; + else if (bin - heap->bins < 0x30 && alloc > 0x800) enable = TRUE; + else if (bin - heap->bins < 0x30 && alloc - freed > 0x10) enable = TRUE; + else if (alloc - freed > 0x400000 / block_size) enable = TRUE; + if (!enable) return; + + if (ReadNoFence( &heap->compat_info ) != HEAP_LFH) + { + ULONG info = HEAP_LFH; + RtlSetHeapInformation( heap, HeapCompatibilityInformation, &info, sizeof(info) ); + } + + /* paired with ReadAcquire in heap_allocate_block_lfh. */ + WriteRelease( &bin->enabled, TRUE ); `heap_allocate_block_lfh` would not be introduced until commit "ntdll: Implement Low Fragmentation Heap frontend." For atomic commits, you should first use `WriteNoFence` and then switch to `WriteRelease` later.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/1628#note_23818