dotnet / dotnet/runtime

Invalid page size assumptions in GC

Open
#133,743 2 comments 0 reactions 1 assignee Assigned to @kkokosa View on GitHub
area-GC-coreclr untriaged
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

> At very least, there seem to be an issue in GC as well:
> ```
> Default 4MiB regions have 32KiB mark bitmaps, so adjacent regions share an OS page.
> Commit accounting double-counts that page, while decommit accounting fails to subtract it, causing the assertion.
>
> With temporary  DOTNET_GCRegionSize=800000  (hexadecimal 8MiB), the full normal Checked CoreCLR suite completed
> ```
> propsed fix:
> ```c
> size_t min_gc_region_size =
> OS_PAGE_SIZE * (mark_word_size / sizeof(uint32_t));
> ```

_Originally posted by @EgorBo in [#133675](https://github.com/dotnet/runtime/issues/133675#issuecomment-5634055644)_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the GC region-size calculation and the mark-bitmap commit/decommit accounting described in the issue. Run the normal Checked CoreCLR suite, including the temporary DOTNET_GCRegionSize=800000 case, and verify that the page-accounting assertion no longer occurs for the default region size.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, csharp
Domain
operating-systems, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.