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

Release allocated resources in Zlib, fixes #43. #100

Merged
merged 1 commit into from
Feb 16, 2022

Conversation

fredrikekre
Copy link
Contributor

@fredrikekre fredrikekre commented Feb 10, 2022

Together with @KristofferC I managed to find a solution to the memory leak issue (#43). It seems that the allocated resources in zlib are never released, but calling finalize does this.

It is a bit unclear from the TranscodingStreams documentation whether this is necessary, or if writing the END_TOKEN should do this. For example: https://juliaio.github.io/TranscodingStreams.jl/latest/#Wrapped-streams-1 hints that one must do something to release them, but in the code here we don't want to call close(zWriter) because that would also close the wrapped stream. https://juliaio.github.io/TranscodingStreams.jl/latest/examples/#Explicitly-finish-transcoding-by-writing-TOKEN_END-1 is a bit unclear what it means to "finishes the current transcoding process without closing the underlying stream", i.e. should that also release the allocated resources or not.

Draft for now, since it is possible this is a bug in TranscodingStreams (see JuliaIO/TranscodingStreams.jl#117)

@codecov-commenter
Copy link

Codecov Report

Merging #100 (1565685) into master (6ef44e4) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #100   +/-   ##
=======================================
  Coverage   96.01%   96.01%           
=======================================
  Files          16       16           
  Lines         803      804    +1     
=======================================
+ Hits          771      772    +1     
  Misses         32       32           
Impacted Files Coverage Δ
src/write_data.jl 96.42% <100.00%> (+0.02%) ⬆️

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 6ef44e4...1565685. Read the comment docs.

@KristofferC
Copy link
Contributor

Imo this should be merged since it fixes a real issue. If the API of TranscodungStreams changes, the code here can change too.

@jipolanco
Copy link
Member

I agree with @KristofferC. I'll merge this if that's OK for @fredrikekre.

BTW thank you both for finding the solution!

@KristofferC
Copy link
Contributor

Valgrind to the rescue :P

@fredrikekre fredrikekre marked this pull request as ready for review February 16, 2022 08:54
@fredrikekre
Copy link
Contributor Author

Sounds good. I don't know what the failure on nightly is, but I don't think it is related.

@jipolanco
Copy link
Member

Great, thanks! The failure on nightly doesn't seem to be related; it happens also on the current master.

@jipolanco jipolanco merged commit fc7900c into JuliaVTK:master Feb 16, 2022
@fredrikekre fredrikekre deleted the fe/fix-compression branch February 16, 2022 08:59
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.

4 participants