module GC
¶
Class methods¶
.malloc(size : Int) : Pointer(Void)
¶
(size : Int) : Pointer(Void)
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.
.malloc_atomic(size : Int) : Pointer(Void)
¶
(size : Int) : Pointer(Void)
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.
.realloc(pointer : Pointer(Void), size : Int) : Pointer(Void)
¶
(pointer : Pointer(Void), size : Int) : Pointer(Void)
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.