How to manually free allocated memory (Pointer.malloc)

You can un-reference (pointer going out of the scope, pointer assigned to some other value/reference etc) the pointer so that GC can re-claim the memory.

Another possibility here could be you invoke Pointer#realloc with lower size or 0.

# un-reference
@arr = Pointer(Floa64).null   

# OR

# re-allocate pointer size
@arr = @arr.realloc(0)
1 Like