Repository navigation
Give ImageMagick's pixel cache back after reading pixels (#2076) - #2079
Draft
cre8ive-marketing wants to merge 1 commit into
Draft
cre8ive-marketing wants to merge 1 commit into
cre8ive-marketing wants to merge 1 commit into
Conversation
…2076) GetPixels() without using kept the pixel cache alive, so each RAW read leaked one picture against policy.xml's memory limit until reads failed with "cache resources exhausted".
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2076.
RawTone.ToSrgbread the pixels withimage.GetPixels().ToByteArray(...)and never disposed the pixel view. An open view keeps ImageMagick's pixel cache alive, soImportPixelsgot a new cache and the old one, counted against the memory limit inpolicy.xml, was never given back. Each RAW file leaked one full picture, and after a few hundred every read failed withcache resources exhausted ... OpenPixelCache/4044until restart.PixelBytes.Read: reads the bytes through a view that is closed before the caller goes on. Used by every Magick.NETGetPixels().ToByteArray(...)that had nousing:RawTone,ImageReader(MIFF),ImageEncoder,Apng,BackdropComposer,Blp,DdsChannelOrder,VtfWriter,ImageTo3DConverter.DdsChannelOrder's one-pixel read gets ausing.PixelBytesTests.Raw_tones_give_the_pixel_cache_back: 40 × 12 MP throughRawTone.ToSrgbunder a 256 MB memory + 256 MB disk limit. It fails on main with the samecache resources exhaustederror, and passes with the fix. It runs on its own, as the limits are global.Checked on Windows: Core 2037 pass; Engines 5292 of 5293 and App 3669 of 3671 pass. The 3 failures look unrelated:
MediaTests.A_photo_becomes_a_still_video_in_full_colourfails the same way on main here (this machine's ImageMagick can't read the test'shald:8picture), and the twoSliceLabelLayoutTestsmeasure label text with this machine's fonts, which this change doesn't touch. Not checked here: a real batch of NEF files in the app.