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_DECIMAL Memory Accumulation #189

Open
almann opened this issue Aug 12, 2020 · 0 comments
Open

ION_DECIMAL Memory Accumulation #189

almann opened this issue Aug 12, 2020 · 0 comments
Labels

Comments

@almann
Copy link
Contributor

almann commented Aug 12, 2020

While implementing the Ion C Rust bindings, I had to read through the memory ownership semantics of decimal writing in ion-binary.c.

The problem with this implementation is that although it allows the caller to "borrow" an ION_DECIMAL, each borrowed decimal gets accumulated with the stream/reader. For large streams of larger than decQuad decimals, this would be an effective memory leak. I believe this is also the case for the text side of the reader.

We should either consider making it managed by the caller (which could break existing clients) or make it use a single pre-allocated decimal to maintain the borrow semantics.

Either way the APIs on the reader do not document the behavior, and so whichever we do, we need to document it explicitly.

@almann almann added the bug label Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant