-
-
Notifications
You must be signed in to change notification settings - Fork 853
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
Unmanaged pooling MemoryAllocator #1730
Merged
antonfirsov
merged 96 commits into
master
from
af/UniformUnmanagedMemoryPoolMemoryAllocator-02
Dec 9, 2021
Merged
Changes from all commits
Commits
Show all changes
96 commits
Select commit
Hold shift + click to select a range
7c1a1af
UniformUnmanagedMemoryPoolMemoryAllocator
antonfirsov ca17d33
use WeakReference with timer, configure trim period for sandbox
antonfirsov fd94dbf
fix trimming
antonfirsov 1a41aaa
LoadResizeSaveParallelMemoryStress help text
antonfirsov aa26b63
Set_MaximumPoolSizeMegabytes_CreateImage_MaximumPoolSizeMegabytes
antonfirsov 172b0a0
MinimumContiguousBlockBytes -> MinimumContiguousBlockSizeBytes
antonfirsov 4251eac
disable CA2015
antonfirsov c9d1396
comments and docs
antonfirsov e13edba
fix .NET Framework build error + a few warnings
antonfirsov 0cdbf72
disable MemoryGroupFinalizer_ReturnsToPool on MacOS
antonfirsov 20d6228
make MemoryGroupFinalizer_ReturnsToPool Windows-only
antonfirsov 1a86d6d
try to mitigate 32 bit failures
antonfirsov 32ae7cf
API chunks
antonfirsov 5dd8594
retry allocation on OOM
antonfirsov f7d9d37
cleanup naming in UniformUnmanagedMemoryPool
antonfirsov 017ee40
Merge branch 'master' into af/UniformUnmanagedMemoryPoolMemoryAllocat…
antonfirsov a67cb01
fix build after merge
antonfirsov e233b81
undo unsafe optimizations in ErrorDither
antonfirsov 5839a5a
PreferContiguousImageBuffers implemented
antonfirsov 2472c42
MemoryAllocatorOptions -> MemoryAllocatorSettings,
antonfirsov 3740471
MemoryAllocator.Create & tests
antonfirsov 003e51e
MemoryAllocator.Default
antonfirsov f81008e
ProcessPixelRows tests
antonfirsov ce1ac2c
pass pinnable correctly
antonfirsov 1df9e25
ProcessPixelRows
antonfirsov 409cfb1
DangerousGetPixelRowMemory
antonfirsov e1f15bc
TryGetSinglePixelSpan -> DangerousTryGetSinglePixelMemory
antonfirsov f178416
test ImageFrame.DangerousGetPixelRowMemory
antonfirsov ff383c9
Buffer2D.GetRowSpan -> DangerousGetRowSpan
antonfirsov fb57101
Merge remote-tracking branch 'origin/master' into af/UniformUnmanaged…
antonfirsov 64a9d25
update webp code
antonfirsov 9047fc9
remove ImageFrame.GetPixelRowSpan
antonfirsov ebe7b9c
Remove Image.DangerousGetRowSpan
antonfirsov f40fc3a
test exception safety of ProcessPixelRows
antonfirsov 251af06
Merge branch 'master' into af/UniformUnmanagedMemoryPoolMemoryAllocat…
antonfirsov 58a23cd
remove ArrayPoolMemoryAllocator from tests
antonfirsov 74d8be6
fix warning & simplify ClearTransparentPixels
antonfirsov 412ebfb
Remove ArrayPoolMemoryAllocator
antonfirsov 2d6596f
CopyPixelDataTo
antonfirsov 8dda1d5
make GetNetCoreVersion work with preview
antonfirsov 7186767
Disable MemoryAllocator_Create_LimitPoolSize on OSX
antonfirsov 14eef74
Use [ConditionalFact] instead of [PlatformSpecific]
antonfirsov a9786b8
Merge branch 'master' into af/UniformUnmanagedMemoryPoolMemoryAllocat…
antonfirsov d09108a
fix test bug in WrapSystemDrawingBitmap_FromBytes_WhenObserved
antonfirsov 2b6d940
update LoadResizeSaveParallelMemoryStress
antonfirsov 7818ae0
temporarily remove try-catch in ImageProcessor<TPixel>.Apply()
antonfirsov f7b5807
(temporarily?) add RunTestsInLoop.ps1
antonfirsov bc70d10
Merge branch 'master' into af/UniformUnmanagedMemoryPoolMemoryAllocat…
antonfirsov bfcb1be
Logging made optional in TestMemoryAllocator
antonfirsov 34a39e5
Relax criteria for Shuffle3
antonfirsov 5c9be36
attempt to fix MemoryAllocator_Create_LimitPoolSize
antonfirsov ab0480f
memory clearing should not be UniformUnmanagedMemoryPool concern
antonfirsov ad982c4
emulate leaks in LoadResizeSaveParallelMemoryStress
antonfirsov 5797197
MemoryOwnerFinalizer_ReturnsToPool
antonfirsov aaacc41
Add missing GC.SuppressFinalize(this)
antonfirsov 27ede23
fixes
antonfirsov 432c03a
remove outdated AllocationOptions.Contiguous
antonfirsov 2b209f0
Merge remote-tracking branch 'origin/master' into af/UniformUnmanaged…
antonfirsov 77e7700
Reimplement buffer ownership management
antonfirsov b43e963
stress testing improvements
antonfirsov b685d37
re-enable tests on Unix
antonfirsov b0b56df
wait a bit more in trim tests
antonfirsov 13a3522
fix tests
antonfirsov 916b31c
Disable MultiplePoolInstances_TrimPeriodElapsed_AllAreTrimmed on MacO…
antonfirsov d045df2
implement pool finalization & cleanup
antonfirsov a827390
Docs and null check on Configuration.MemoryAllocator.
antonfirsov 452f31c
Disable RentReturnRelease_SubsequentRentReturnsDifferentHandles on Mac.
antonfirsov 0de983b
Merge branch 'master' into af/UniformUnmanagedMemoryPoolMemoryAllocat…
antonfirsov 308676e
promote Debug-InnerLoop hack
antonfirsov 62943a1
Merge branch 'master' into af/UniformUnmanagedMemoryPoolMemoryAllocat…
antonfirsov 4865ada
cleanup & comments
antonfirsov 8c39628
make MemoryAllocatorSettings a struct
antonfirsov 42546d0
nits
antonfirsov a02d88a
address some unrelated coverage issues reported by CodeCov for some r…
antonfirsov a3a6d1d
Always disable MultiplePoolInstances_TrimPeriodElapsed_AllAreTrimmed …
antonfirsov 7ec7447
fix DetectEncoder tests
antonfirsov 9ec8dc7
remove processor exception wrapping forever, fixes #1827
antonfirsov e10126e
use standard NETCOREAPP3_1_OR_GREATER directive
antonfirsov ee3265c
add back unsafe optimizations in ErrorDither
antonfirsov a57250e
oops
antonfirsov 9f55e3f
fix comment
antonfirsov adaa67e
Merge branch 'master' into af/UniformUnmanagedMemoryPoolMemoryAllocat…
JimBobSquarePants f10da94
MemoryAllocatorSettings -> MemoryAllocatorOptions
antonfirsov 751fc06
update shared-infrastructure
antonfirsov 66967ab
Merge branch 'master' into af/UniformUnmanagedMemoryPoolMemoryAllocat…
antonfirsov d35b239
automatic consequence of shared-infrastructure update?
antonfirsov 90316a1
serialize MultiplePoolInstances_TrimPeriodElapsed_AllAreTrimmed
antonfirsov 7eaa5ee
attempt to re-enable MultiplePoolInstances_TrimPeriodElapsed_AllAreTr…
antonfirsov c90993b
Comments on [Theory] data
antonfirsov 01f055a
Revert "attempt to re-enable MultiplePoolInstances_TrimPeriodElapsed_…
antonfirsov 4986c52
Address local failures caused by high memory load
antonfirsov 5b8be24
Merge branch 'master' into af/UniformUnmanagedMemoryPoolMemoryAllocat…
antonfirsov 64d11ee
Merge branch 'af/UniformUnmanagedMemoryPoolMemoryAllocator-02' of htt…
antonfirsov 53726f5
Merge branch 'master' into af/UniformUnmanagedMemoryPoolMemoryAllocat…
antonfirsov 1e24da4
improve test naming
antonfirsov 5eaa632
Merge branch 'af/UniformUnmanagedMemoryPoolMemoryAllocator-02' of htt…
antonfirsov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule shared-infrastructure
updated
4 files
+6 −2 | .gitattributes | |
+11 −0 | codecov.yml | |
+1 −1 | msbuild/props/SixLabors.Tests.props | |
+1 −1 | msbuild/targets/SixLabors.Src.targets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Did we have a scenario where they weren't the same length? When I wrote this
IShuffle3
andIShuffle4
were mirrored implementations designed for working against specific pixel formats.VerifyShuffle4SpanInput
still checks for equality.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.
The original version fails
EncodeBaseline_WorksWithDiscontiguousBuffers<Bgr24>
on current master, we just did not notice it since CI doesn't run tests in Debug (maybe it should?).this.rgbSpan
is longer thanthis.pixelSpan
here:ImageSharp/src/ImageSharp/Formats/Jpeg/Components/Encoder/YCbCrForwardConverter420{TPixel}.cs
Line 109 in 659daff
because of the padding added by @br3aker:
ImageSharp/src/ImageSharp/Formats/Jpeg/Components/Encoder/YCbCrForwardConverter420{TPixel}.cs
Line 88 in 659daff
I believe we should follow
Span.CopyTo(source, dest)
semantics in this family of methods, which allowsdest
to be longer and processessource.Length
items.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.
Oh please no! They take long enough!! 🤣
I agree then and we should update
VerifyShuffle4SpanInput
to match.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.
We can introduce a new
Checked
build configuration, like many C/C++ projects do. It's basically Release build but with all the checks/guards enabled.