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

Out of memory management #241

Open
ghost opened this issue Jun 12, 2022 · 1 comment
Open

Out of memory management #241

ghost opened this issue Jun 12, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 12, 2022

With try_reserve available for Vec, the checked operations (e.g. checked_add) could return None when out of memory.

Is this extension possible in checked traits?

@cuviper
Copy link
Member

cuviper commented Jun 15, 2022

(Assuming we bump the MSRV to 1.57 for try_reserve...)

That's certainly possible, but I don't think it's a good idea, because the current purpose of those methods is only to detect arithmetic overflow. I think it would be semantically confusing for this to also conflate OOM.

Maybe it would make sense to have try_op methods which return a Result, and the error type could indicate the type of failure. It may be difficult to thread this through the more complicated operations though, like multiplication and division.

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

1 participant