Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue in decommit_ephemeral_segment_pages (segment case). (dotnet…
…#59989) We assume that we can use half the free list space in gen 0 for new allocation. If that is too optimistic, we may allocate into decommitted memory and crash in the allocator. That is because there is a race condition between the allocating thread and the decommitting thread - we decided to avoid that by making sure we would never decommit memory that we may allocate in gen 0. There are two reasons why assuming we can use half the free list space for new allocations may be too optimistic: - if we allocate large objects in gen 0, we may not have free spaces of the necessary size available. - when background GC goes into background_ephemeral_sweep, it deletes and rebuilds the free list for gen 0. A thread trying to allocate during that time may see a completely empty free list.
- Loading branch information