Module mun_runtime::gc
source · Expand description
Exposes Mun garbage collection.
Structs
A
GcPtr
is what you interact with outside of the allocator. It is a pointer to a piece of
memory that points to the actual data stored in memory.Functions
Allocates an object in the runtime of the given
ty
. If successful, obj
is set,
otherwise a non-zero error handle is returned.Collects all memory that is no longer referenced by rooted objects. If successful,
reclaimed
is set, otherwise a non-zero error handle is returned. If reclaimed
is true
, memory was
reclaimed, otherwise nothing happend. This behavior will likely change in the future.Retrieves the
ty
for the specified obj
from the runtime. If successful, ty
is set,
otherwise a non-zero error handle is returned.Roots the specified
obj
, which keeps it and objects it references alive. Objects marked as
root, must call mun_gc_unroot
before they can be collected. An object can be rooted multiple
times, but you must make sure to call mun_gc_unroot
an equal number of times before the
object can be collected. If successful, obj
has been rooted, otherwise a non-zero error handle
is returned.Unroots the specified
obj
, potentially allowing it and objects it references to be
collected. An object can be rooted multiple times, so you must make sure to call mun_gc_unroot
the same number of times as mun_gc_root
was called before the object can be collected. If
successful, obj
has been unrooted, otherwise a non-zero error handle is returned.