module GC
Defined in:
gc.crgc/boehm.cr
gc/none.cr
Class Method Summary
-
.collect : Nil
Collect the HEAP memory now, instead of waiting until the HEAP is full.
-
.disable : Nil
Disables GC collections.
-
.enable : Nil
Enables GC collections.
-
.malloc(size : Int) : Pointer(Void)
Allocates and clears size bytes of memory.
-
.malloc_atomic(size : Int) : Pointer(Void)
Allocates size bytes of pointer-free memory.
-
.prof_stats
Returns extended profiling statistics about the HEAP memory and GC collections.
-
.realloc(pointer : Pointer(T), size : Int) : Pointer(T) forall T
Changes the allocated memory size of pointer to size.
-
.stats : GC::Stats
Returns statistics about the current HEAP memory.
Class Method Detail
Collect the HEAP memory now, instead of waiting until the HEAP is full.
Disables GC collections. The GC will always increase the HEAP size when the
HEAP is full. Call GC.enable as many times as GC.disable was called to
reenable GC collections.
Enables GC collections. This is the default behavior. The GC will collect
memory when the HEAP is full. Must be called as many times as GC.disable
was called.
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.
If the memory can't be allocated (out of memory), the program aborts with an error message written to the standard error.
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.
If the memory can't be allocated (out of memory), the program aborts with an error message written to the standard error.
Returns extended profiling statistics about the HEAP memory and GC collections.
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.
If the memory can't be allocated (out of memory), the program aborts with an error message written to the standard error.
WARNING Memory allocated using Pointer.malloc must be reallocated using
Pointer#realloc instead.