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

Illegal cpu instruction on OOM? #132

Closed
mexus opened this issue Apr 20, 2019 · 2 comments
Closed

Illegal cpu instruction on OOM? #132

mexus opened this issue Apr 20, 2019 · 2 comments

Comments

@mexus
Copy link
Contributor

mexus commented Apr 20, 2019

On the Allocating Memory page it is said that the oom langitem aborts the program by executing an "illegal cpu instruction":

The standard library calls std::alloc::oom(), which in turn calls the the oom langitem. By default this just aborts the program by executing an illegal cpu instruction.

I've checked the code and found out that the alloc lib actually calls std::sys::abort_internal in rust_oom (alloc::alloc::handle_alloc_errorstd::alloc::rust_oom), which resolves for example into a libc::abort call on unix, which doesn't call any illegal instructions in my understanding but rather sends a SIGABRT to the process.

Please correct me if I'm wrong, it might be that I've got the whole idea wrong, but I believe that phrase

. By default this just aborts the program by executing an illegal cpu instruction.

should be replaced with something like

, which aborts the program in a platform-specific manner.

Thanks!

@Gankra
Copy link
Contributor

Gankra commented Apr 20, 2019

yeah that's probably fair

mexus added a commit to mexus/nomicon that referenced this issue Apr 20, 2019
@mexus
Copy link
Contributor Author

mexus commented Apr 20, 2019

Closing since the PR was merged, thanks!

@mexus mexus closed this as completed Apr 20, 2019
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