[−][src]Struct rutie::GC
Garbage collection
Methods
impl GC
[src]
pub fn adjust_memory_usage(diff: isize)
[src]
Notify memory usage to the GC engine by extension libraries, to trigger GC This is useful when you wrap large rust objects using wrap_data, when you do so, ruby is unaware of the allocated memory and might not run GC
Examples
use rutie::{GC, VM}; GC::adjust_memory_usage(25_000); // Tell ruby that we somehow allocated 25_000 bytes of mem GC::adjust_memory_usage(-15_000); // Tell ruby that freed 15_000 bytes of mem
pub fn count() -> usize
[src]
The number of times GC occurred.
It returns the number of times GC occurred since the process started.
Examples
use rutie::{GC, VM}; GC::count();
pub fn disable() -> bool
[src]
pub fn enable() -> bool
[src]
pub fn force_recycle(object: impl Object)
[src]
Forcibly GC object.
Examples
use rutie::{RString, GC, VM}; let obj = RString::new_utf8("asdf"); GC::force_recycle(obj);
pub unsafe fn is_marked(object: &impl Object) -> bool
[src]
Check if object is marked
CAUTION: THIS FUNCTION IS ENABLED ONLY BEFORE SWEEPING. This function is only for GC_END_MARK timing.
Examples
use rutie::{RString, GC, VM}; let obj = RString::new_utf8("asdf"); GC::mark(&obj); assert!(unsafe {GC::is_marked(&obj) }, "Object was not marked");
pub fn mark(object: &impl Object)
[src]
Mark an object for Ruby to avoid garbage collecting item.
If the wrapped struct in Rust references Ruby objects, then you'll have to mark those in the mark callback you are passing to wrapped struct.
Examples
use rutie::{RString, GC, VM}; let object = RString::new_utf8("1"); GC::mark(&object);
pub fn mark_locations(range: &[impl Object])
[src]
Mark all of the object from start
to end
of the array for the GC.
Examples
use rutie::{RString, GC, VM, AnyObject}; let arr = [ RString::new_utf8("1"), RString::new_utf8("2"), RString::new_utf8("3"), RString::new_utf8("4"), ]; GC::mark_locations(&arr);
pub fn mark_maybe(object: &impl Object)
[src]
Maybe mark an object for Ruby to avoid garbage collecting item.
If the wrapped struct in Rust references Ruby objects, then you'll have to mark those in the mark callback you are passing to wrapped struct.
Examples
use rutie::{RString, GC, VM}; let object = RString::new_utf8("1"); GC::mark_maybe(&object);
pub fn register(object: &impl Object)
[src]
Registers the objects address with the GC
Examples
use rutie::{RString, GC, VM}; let object = RString::new_utf8("1"); GC::register(&object);
pub fn register_mark(object: &impl Object)
[src]
Mark an object as in use for Ruby to avoid garbage collecting item.
If the wrapped struct in Rust references Ruby objects, then you'll have to mark those in the mark callback you are passing to wrapped struct.
Examples
use rutie::{RString, GC, VM}; let object = RString::new_utf8("1"); GC::register_mark(&object);
pub fn start()
[src]
pub fn stat(key: &str) -> usize
[src]
Get the GC stats for a specific key
Note: Will panic if provided an invalid key.
Examples
use rutie::{GC, VM}; let result = GC::stat("heap_allocated_pages");
pub fn unregister(object: &impl Object)
[src]
Unregisters the objects address with the GC
Examples
use rutie::{RString, GC, VM}; let object = RString::new_utf8("1"); GC::unregister(&object);
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,