module GC

Defined in:

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

Class Method Summary

Class Method Detail

def self.add_finalizer(object : Reference) : NilSource

def self.add_finalizer(object)Source

def self.add_root(object : Reference)Source

def self.collectSource

def self.disableSource

def self.enableSource

def self.free(pointer : Pointer(Void)) : NilSource

def self.initSource

def self.is_heap_ptr(pointer : Pointer(Void)) : BoolSource

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

Allocates and clears size 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)Source

Allocates size 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_statsSource

def self.realloc(pointer : Pointer(Void), size : Int) : Pointer(Void)Source

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

If pointer was allocated with .malloc_atomic, the same constraints apply.

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

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

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

def self.stats : GC::StatsSource

© 2012–2021 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/1.2.1/GC.html