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

Ion stream is not getting closed when using a binary writer. #256

Closed
wibloe opened this issue Nov 12, 2021 · 2 comments
Closed

Ion stream is not getting closed when using a binary writer. #256

wibloe opened this issue Nov 12, 2021 · 2 comments

Comments

@wibloe
Copy link

wibloe commented Nov 12, 2021

We are using a binary writer created by ion_writer_open_buffer(). When the data is written, the writer is closed. While doing the open, write(s) and close repeatedly, we've noticed increasing memory usage. The memory leak seems to be caused by the _value_stream in the _ion_binary_writer structure not getting closed when the writer is closed. Adding the following before closing the writer fixed the problem:

rc = ion_stream_close(writer->_typed_writer.binary._value_stream);

Also, is it possible to reuse the writer created with ion_writer_open_buffer() so could I skip the closing and creating a new writer?

Thanks!

@cheqianh
Copy link
Contributor

cheqianh commented Nov 18, 2021

Thanks for reporting this, I created a PR fixing this.

For the second question. I looked into ion-c writer APIs but didn't find an obvious way to reuse the writer. I'll discuss this with our ion-c expert and update it here if I missed anything.

@cheqianh
Copy link
Contributor

cheqianh commented Nov 19, 2021

Fix #257 is merged. Feel free to reopen if you need anything else.

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

No branches or pull requests

2 participants