module GC

Defined in:

gc.cr
gc/boehm.cr
gc/none.cr

Class Method Summary

Class Method Detail

def self.add_finalizer(object : Reference) : Nil #

def self.add_finalizer(object) #

def self.add_root(object : Reference) #

def self.collect #

def self.disable #

def self.enable #

def self.free(pointer : Pointer(Void)) : Nil #

def self.init #

def self.is_heap_ptr(pointer : Pointer(Void)) : Bool #

def self.malloc(size : Int) : Pointer(Void) #

Allocates and clearssize bytes of memory.

The resulting object may contain pointers and they will be tracked by the GC.

The memory will be automatically deallocated when unreferenced.


def self.malloc_atomic(size : Int) : Pointer(Void) #

Allocatessize bytes of pointer-free memory.

The client promises that the resulting object will never contain any pointers.

The memory is not cleared. It will be automatically deallocated when unreferenced.


def self.prof_stats #

def self.realloc(pointer : Pointer(T), size : Int) : Pointer(T) forall T #

Changes the allocated memory size ofpointer tosize. If this can't be done in place, it allocatessize bytes of memory and copies the content ofpointer to the new location.

Ifpointer was allocated with.malloc_atomic, the same constraints apply.

The return value is a pointer that may be identical topointer or different.

WARNING Memory allocated usingPointer.malloc must be reallocated using Pointer#realloc instead.


def self.register_disappearing_link(pointer : Pointer(Pointer(Void))) #

def self.set_stackbottom(stack_bottom : Pointer(Void)) #

def self.stats : GC::Stats #