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

Allocation failures are not panics #651

Closed
Darksonn opened this issue Nov 28, 2023 · 2 comments
Closed

Allocation failures are not panics #651

Darksonn opened this issue Nov 28, 2023 · 2 comments

Comments

@Darksonn
Copy link

This is a documentation bug report. I've noticed that functions sometimes include a section like the following:

Panics

Panics if Vec::reserve(additional) fails to reserve enough memory.

Allocation failures are handled by just calling into vec.reserve. However, the reserve method does not panic on allocation failure. Instead, it calls abort.

@joshlf
Copy link
Member

joshlf commented Nov 28, 2023

Looks like vec.reserve bottoms out in handle_alloc_error, which may panic or abort depending on how the binary was built. Maybe this should say:

If Vec::reserve(additional) fails to reserve enough memory, extend_vec_zeroed may panic or abort depending on how the program is configured to handle allocation failure.

@joshlf
Copy link
Member

joshlf commented Oct 6, 2024

Closed by #1478

@joshlf joshlf closed this as completed Oct 6, 2024
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