Function magnus::gc::adjust_memory_usage

source ·
pub fn adjust_memory_usage(diff: isize)
Expand description

Inform Ruby of external memory usage.

The Ruby GC is run when Ruby thinks it’s running out of memory, but won’t take into account any memory allocated outside of Ruby api functions. This function can be used to give Ruby a more accurate idea of how much memory the process is using.

Pass negative numbers to indicate memory has been freed.

Panics

Panics if called from a non-Ruby thread.