Jinoh Kang (@iamahuman) commented about dlls/ntdll/heap.c:
+ +/* release a thread owned and fully freed group to the bin shared group, or free its memory */ +static NTSTATUS heap_release_bin_group( struct heap *heap, ULONG flags, struct bin *bin, struct group *group ) +{ + ULONG affinity = group->affinity; + + /* using InterlockedExchangePointer here would possibly return a group that has used blocks, + * we prefer keeping our fully freed group instead for reduced memory consumption. + */ + if (!InterlockedCompareExchangePointer( (void *)bin_get_affinity_group( bin, affinity ), group, NULL )) + return STATUS_SUCCESS; + + /* try re-using the block group instead of releasing it */ + if (RtlQueryDepthSList( &bin->groups ) <= ARRAY_SIZE(affinity_mapping)) + { + RtlInterlockedPushEntrySList( &bin->groups, (SLIST_ENTRY *)&group->entry ); You no longer need cast here. \[redundant-cast-v10\]
RtlInterlockedPushEntrySList( &bin->groups, &group->entry );
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/1628#note_23835