new_finalizable_handle

Function new_finalizable_handle 

Source
pub unsafe fn new_finalizable_handle(
    object: Dart_Handle,
    peer: *mut c_void,
    external_allocation_size: isize,
    callback: Dart_HandleFinalizer,
) -> Dart_FinalizableHandle
Expand description

Allocates a finalizable handle for an object.

This handle has the lifetime of the current isolate group unless the object pointed to by the handle is garbage collected, in this case the VM automatically deletes the handle after invoking the callback associated with the handle.

Once finalizable handle is collected by GC, the provided callback is called. It may be executed on any thread, will have an isolate group, but won’t have the current isolate.

peer argument will be provided to the callback on finalize.

external_allocation_size is a size of the peer which can be calculated via mem::size_of().

§Safety

initialize_api must be called before this function.