Skip to content

Commit ae57078

Browse files
Merge branch 'main' into dependabot/github_actions/actions/upload-artifact-6
2 parents 182874e + 10f8b0f commit ae57078

4 files changed

Lines changed: 10 additions & 33 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
run: echo "lfs_key=$LFS_KEY" >> "$GITHUB_OUTPUT"
5050

5151
- name: Git Setup LFS Cache
52-
uses: actions/cache@v4
52+
uses: actions/cache@v5
5353
with:
5454
path: .git/lfs
5555
key: ${{ steps.expose-key.outputs.lfs_key }}
@@ -144,7 +144,7 @@ jobs:
144144

145145
# Use the warmed key from WarmLFS. Do not recompute or recreate .lfs-assets-id here.
146146
- name: Git Setup LFS Cache
147-
uses: actions/cache@v4
147+
uses: actions/cache@v5
148148
with:
149149
path: .git/lfs
150150
key: ${{ needs.WarmLFS.outputs.lfs_key }}
@@ -157,7 +157,7 @@ jobs:
157157
uses: NuGet/setup-nuget@v2
158158

159159
- name: NuGet Setup Cache
160-
uses: actions/cache@v4
160+
uses: actions/cache@v5
161161
id: nuget-cache
162162
with:
163163
path: ~/.nuget
@@ -236,7 +236,7 @@ jobs:
236236
uses: NuGet/setup-nuget@v2
237237

238238
- name: NuGet Setup Cache
239-
uses: actions/cache@v4
239+
uses: actions/cache@v5
240240
id: nuget-cache
241241
with:
242242
path: ~/.nuget

.github/workflows/code-coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
run: git lfs ls-files -l | awk '{print $1}' | sort > .lfs-assets-id
4747

4848
- name: Git Setup LFS Cache
49-
uses: actions/cache@v4
49+
uses: actions/cache@v5
5050
id: lfs-cache
5151
with:
5252
path: .git/lfs
@@ -59,7 +59,7 @@ jobs:
5959
uses: NuGet/setup-nuget@v2
6060

6161
- name: NuGet Setup Cache
62-
uses: actions/cache@v4
62+
uses: actions/cache@v5
6363
id: nuget-cache
6464
with:
6565
path: ~/.nuget

src/ImageSharp/Memory/Allocators/UniformUnmanagedMemoryPoolMemoryAllocator.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ internal UniformUnmanagedMemoryPoolMemoryAllocator(
7171
this.nonPoolAllocator = new UnmanagedMemoryAllocator(unmanagedBufferSizeInBytes);
7272
}
7373

74-
// This delegate allows overriding the method returning the available system memory,
75-
// so we can test our workaround for https://github.com/dotnet/runtime/issues/65466
76-
internal static Func<long> GetTotalAvailableMemoryBytes { get; set; } = () => GC.GetGCMemoryInfo().TotalAvailableMemoryBytes;
77-
7874
/// <inheritdoc />
7975
protected internal override int GetBufferCapacityInBytes() => this.poolBufferSizeInBytes;
8076

@@ -155,20 +151,14 @@ internal override MemoryGroup<T> AllocateGroupCore<T>(
155151

156152
private static long GetDefaultMaxPoolSizeBytes()
157153
{
158-
// On 64 bit set the pool size to a portion of the total available memory.
159-
// https://github.com/dotnet/runtime/issues/55126#issuecomment-876779327
160154
if (Environment.Is64BitProcess)
161155
{
162-
long total = GetTotalAvailableMemoryBytes();
163-
164-
// Workaround for https://github.com/dotnet/runtime/issues/65466
165-
if (total > 0)
166-
{
167-
return (long)((ulong)total / 8);
168-
}
156+
// On 64 bit set the pool size to a portion of the total available memory.
157+
GCMemoryInfo info = GC.GetGCMemoryInfo();
158+
return info.TotalAvailableMemoryBytes / 8;
169159
}
170160

171-
// Stick to a conservative value of 128 Megabytes on other platforms and 32 bit .NET 5.0:
161+
// Stick to a conservative value of 128 Megabytes on 32 bit.
172162
return 128 * OneMegabyte;
173163
}
174164
}

tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -409,19 +409,6 @@ private static void AllocateSingleAndForget(UniformUnmanagedMemoryPoolMemoryAllo
409409
g = null;
410410
}
411411

412-
[Fact]
413-
public void Issue2001_NegativeMemoryReportedByGc()
414-
{
415-
RemoteExecutor.Invoke(RunTest).Dispose();
416-
417-
static void RunTest()
418-
{
419-
// Emulate GC.GetGCMemoryInfo() issue https://github.com/dotnet/runtime/issues/65466
420-
UniformUnmanagedMemoryPoolMemoryAllocator.GetTotalAvailableMemoryBytes = () => -402354176;
421-
_ = MemoryAllocator.Create();
422-
}
423-
}
424-
425412
[Fact]
426413
public void Allocate_OverLimit_ThrowsInvalidMemoryOperationException()
427414
{

0 commit comments

Comments
 (0)