Docs.rs
  • rb-sys-0.9.81
    • rb-sys 0.9.81
    • Docs.rs crate page
    • MIT OR Apache-2.0
    • Links
    • Homepage
    • Repository
    • crates.io
    • Source
    • Owners
    • matsadler
    • ianks
    • Dependencies
      • rusty-fork ^0.3.0 dev
      • rb-sys-build ^0.9.81 build
    • Versions
    • 70.76% of the crate is documented
  • Go to latest version
  • Platform
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Badges
    • Builds
    • Metadata
    • Shorthand URLs
    • Download
    • Rustdoc JSON
    • Build queue
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation
logo

logo

In rb_sys::bindings::uncategorized

?
Change settings

Function rb_sys::bindings::uncategorized::ruby_xmalloc

source ·
pub unsafe extern "C" fn ruby_xmalloc(size: size_t) -> *mut c_void
Expand description

Allocates a storage instance. It is largely the same as system malloc(), except:

  • It raises Ruby exceptions instead of returning NULL, and
  • In case of ENOMEM it tries to GC to make some room.

@param[in] size Requested amount of memory. @exception rb_eNoMemError No space left for size bytes allocation. @return A valid pointer to an allocated storage instance; which has at least size bytes width, with appropriate alignment detected by the underlying malloc() routine. @note It doesn’t return NULL. @note Unlike some malloc() implementations, it allocates something and returns a meaningful value even when size is equal to zero. @warning The return value shall be invalidated exactly once by either ruby_xfree(), ruby_xrealloc(), or ruby_xrealloc2(). It is a failure to pass it to system free(), because the system and Ruby might or might not share the same malloc() implementation.

Generated by rb-sys for Ruby 3.0.2