The Wayback Machine - https://web.archive.org/web/20200907031556/https://github.com/json-iterator/java/pull/243
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

Fixed leaky buffer when streaming. #243

Open
wants to merge 8 commits into
base: master
from

Conversation

@svobol13
Copy link

svobol13 commented Jun 15, 2019

Reworked a way how internal buffer size increases when streaming. The new way changes both when and how it increases size.

When: Whenever current buffer size is fully utilized AND autoresizing is enabled.
How: It increases buffer size with configured absolute number of bytes instead of doubling the capacity.

New API: Added new factory method parse(InputStream in, int bufSize, int autoExpandBufferStep) that creates Iterator with posibility to control how autoresizing works. Set 0 to disable, set 5 to increase buffer size of 5 bytes everytime we hit end.

Backward compatibility: Factory parse(InputStream in, int bufSize) was changed with respect to previous setting. First increase of buffer size is exactly same as it was in pass though any subsequent increase is same size as first one in contrast to previous behaviour (it was growing exponentially).

@codecov-io
Copy link

codecov-io commented Jun 15, 2019

Codecov Report

Merging #243 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #243      +/-   ##
=========================================
+ Coverage   68.46%   68.5%   +0.04%     
=========================================
  Files         107     107              
  Lines        7335    7338       +3     
  Branches     1388    1389       +1     
=========================================
+ Hits         5022    5027       +5     
+ Misses       1867    1866       -1     
+ Partials      446     445       -1
Impacted Files Coverage Δ
src/main/java/com/jsoniter/IterImpl.java 66.11% <ø> (ø) ⬆️
...c/main/java/com/jsoniter/IterImplForStreaming.java 70.73% <100%> (+0.46%) ⬆️
src/main/java/com/jsoniter/JsonIterator.java 65.54% <100%> (+0.52%) ⬆️

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 e48a7a1...2a575f8. Read the comment docs.

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

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.