Skip to content

Workaround GC.GetMemoryInfo() ARM32 issue - #2025

Merged
antonfirsov merged 4 commits into
mainfrom
af/TotalAvailableMemoryBytes-workaround
Feb 22, 2022
Merged

antonfirsov merged 4 commits into
mainfrom
af/TotalAvailableMemoryBytes-workaround

Conversation

@antonfirsov

@antonfirsov antonfirsov commented Feb 21, 2022 •

Copy link
Copy Markdown
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Workaround dotnet/runtime#65466 by using the constant fallback pool size if negative memory is reported.

Fixes #2001.


// This delegate allows overriding the method returning the available system memory,
// so we can test our workaround for https://github.com/dotnet/runtime/issues/65466
internal static Func<long> GetTotalAvailableMemoryBytes { get; set; } = () => GC.GetGCMemoryInfo().TotalAvailableMemoryBytes;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're missing a condition here.

#if NETCOREAPP3_1_OR_GREATER

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antonfirsov I've pushed the fix.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed the comment and also pushed it 🙈

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doubled fixed now then. We know it's good 😄

@antonfirsov
antonfirsov merged commit 3259c94 into main Feb 22, 2022
@antonfirsov
antonfirsov deleted the af/TotalAvailableMemoryBytes-workaround branch February 22, 2022 02:09
antonfirsov added a commit that referenced this pull request Feb 17, 2026
@antonfirsov antonfirsov mentioned this pull request Feb 17, 2026
4 tasks done
JimBobSquarePants added a commit that referenced this pull request Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default MemoryAllocator creation crashes on Raspberry Pi OS 11

2 participants