rune::alloc

Module limit

Source
Expand description

Memory limits for Rune.

This module contains methods which allows for limiting the memory use of the virtual machine to abide by the specified memory limit.

By default memory limits are disabled, but can be enabled by wrapping your function call or future in with.

§Limitations

Limiting is plugged in at the Rust allocator level, and does not account for allocator overhead. Allocator overhead comes about because an allocator needs to use some extra system memory to perform internal bookkeeping. Usually this should not be an issue, because the allocator overhead should be a fragment of memory use. But the exact details would depend on the global allocator used.

As an example, see the implementation notes for jemalloc.

Structs§

  • Something being budgeted.

Functions§

  • Get remaining memory that may be allocated.
  • Wrap the given value with a memory limit. Using a value of usize::MAX effectively disables the memory limit.