File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed
src/ImageSharp/Memory/Allocators
tests/ImageSharp.Tests/Memory/Allocators Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 2222 sdk-preview : true
2323 runtime : -x64
2424 codecov : false
25- - os : macos-latest
25+ - os : macos-13 # macos- latest runs on arm64 runners
2626 framework : net6.0
2727 sdk : 6.0.x
2828 sdk-preview : true
3838 framework : net5.0
3939 runtime : -x64
4040 codecov : false
41- - os : macos-latest
41+ - os : macos-13 # macos- latest runs on arm64 runners
4242 framework : net5.0
4343 runtime : -x64
4444 codecov : false
5050 framework : netcoreapp3.1
5151 runtime : -x64
5252 codecov : false
53- - os : macos-latest
53+ - os : macos-13 # macos- latest runs on arm64 runners
5454 framework : netcoreapp3.1
5555 runtime : -x64
5656 codecov : false
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ public static MemoryAllocator Create(MemoryAllocatorOptions options)
5151 UniformUnmanagedMemoryPoolMemoryAllocator allocator = new ( options . MaximumPoolSizeMegabytes ) ;
5252 if ( options . AllocationLimitMegabytes . HasValue )
5353 {
54- allocator . MemoryGroupAllocationLimitBytes = options . AllocationLimitMegabytes . Value * 1024 * 1024 ;
54+ allocator . MemoryGroupAllocationLimitBytes = options . AllocationLimitMegabytes . Value * 1024L * 1024L ;
5555 allocator . SingleBufferAllocationLimitBytes = ( int ) Math . Min ( allocator . SingleBufferAllocationLimitBytes , allocator . MemoryGroupAllocationLimitBytes ) ;
5656 }
5757
Original file line number Diff line number Diff line change @@ -436,5 +436,21 @@ static void RunTest()
436436 }
437437 }
438438#endif
439+
440+ [ ConditionalFact ( typeof ( Environment ) , nameof ( Environment . Is64BitProcess ) ) ]
441+ public void MemoryAllocator_Create_SetHighLimit ( )
442+ {
443+ RemoteExecutor . Invoke ( RunTest ) . Dispose ( ) ;
444+ static void RunTest ( )
445+ {
446+ const long threeGB = 3L * ( 1 << 30 ) ;
447+ MemoryAllocator allocator = MemoryAllocator . Create ( new MemoryAllocatorOptions ( )
448+ {
449+ AllocationLimitMegabytes = ( int ) ( threeGB / 1024 )
450+ } ) ;
451+ using MemoryGroup < byte > memoryGroup = allocator . AllocateGroup < byte > ( threeGB , 1024 ) ;
452+ Assert . Equal ( threeGB , memoryGroup . TotalLength ) ;
453+ }
454+ }
439455 }
440456}
You can’t perform that action at this time.
0 commit comments