-
-
Notifications
You must be signed in to change notification settings - Fork 855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workaround GC.GetMemoryInfo() ARM32 issue #2025
Conversation
@@ -74,6 +74,10 @@ public UniformUnmanagedMemoryPoolMemoryAllocator(int? maxPoolSizeMegabytes) | |||
this.nonPoolAllocator = new UnmanagedMemoryAllocator(unmanagedBufferSizeInBytes); | |||
} | |||
|
|||
// 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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 🙈
There was a problem hiding this comment.
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 😄
…hub.com/SixLabors/ImageSharp into af/TotalAvailableMemoryBytes-workaround
Prerequisites
Description
Workaround dotnet/runtime#65466 by using the constant fallback pool size if negative memory is reported.
Fixes #2001.