Skip to content
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

Disposing data chunk instead of explicit returning it to ArrayPool in PngDecoderCore.Identify #534

Conversation

denisivan0v
Copy link
Contributor

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

The new Image.Identify API was introduced in #292. In #475 memory management was significantly improved, but there is still a case for png format when ArrayPool is used directly when calling Image.Identify, not with IManagedByteBuffer API.
This leads to the issue when ArgumentException is throwing in ArrayPool.Return method with this message:

The buffer is not associated with this pool and may not be returned to it.
Parameter name: array

This PR fixes this problem.

@JimBobSquarePants
Copy link
Member

Hi @denisivan0v

Good catch! I'll get this merged once the CI finished 👍

@codecov
Copy link

codecov bot commented Apr 18, 2018

Codecov Report

Merging #534 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #534      +/-   ##
=========================================
- Coverage   87.21%   87.2%   -0.02%     
=========================================
  Files         842     842              
  Lines       35452   35451       -1     
  Branches     2627    2627              
=========================================
- Hits        30920   30914       -6     
- Misses       3763    3767       +4     
- Partials      769     770       +1
Impacted Files Coverage Δ
src/ImageSharp/Formats/Png/PngDecoderCore.cs 68.37% <100%> (-0.07%) ⬇️
tests/ImageSharp.Tests/TestFileSystem.cs 63.63% <0%> (-13.64%) ⬇️
tests/ImageSharp.Tests/TestFormat.cs 75% <0%> (-2.39%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3bb07dd...511bdc6. Read the comment docs.

@JimBobSquarePants JimBobSquarePants merged commit c2e898a into SixLabors:master Apr 18, 2018
@denisivan0v
Copy link
Contributor Author

Many thanks @JimBobSquarePants! 🎉

@JimBobSquarePants
Copy link
Member

No worries! Thanks for the PR! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants