Skip to content

Illegal cpu instruction on OOM? #132

@mexus

Description

@mexus

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions