@@ -49,21 +49,21 @@ func getSize[T any]() int {
4949
5050// Alloc allocates T and returns a pointer to it.
5151func Alloc [T any ](a Allocator ) * T {
52- ptr := a .Alloc ( getSize [T ]())
52+ ptr := a .alloc ( a . allocator , getSize [T ]())
5353 return (* T )(unsafe .Pointer (ptr ))
5454}
5555
5656// FreeMany frees memory allocated by Alloc takes a ptr
5757// CAUTION: be careful not to double free, and prefer using defer to deallocate
5858func Free [T any ](a Allocator , ptr * T ) {
59- a .Free ( unsafe .Pointer (ptr ))
59+ a .free ( a . allocator , unsafe .Pointer (ptr ))
6060}
6161
6262// AllocMany allocates n of T and returns a slice representing the heap.
6363// CAUTION: don't append to the slice, the purpose of it is to replace pointer
6464// arithmetic with slice indexing
6565func AllocMany [T any ](a Allocator , n int ) []T {
66- ptr := a .Alloc ( getSize [T ]() * n )
66+ ptr := a .alloc ( a . allocator , getSize [T ]()* n )
6767 return unsafe .Slice (
6868 (* T )(ptr ),
6969 n ,
@@ -73,12 +73,12 @@ func AllocMany[T any](a Allocator, n int) []T {
7373// FreeMany frees memory allocated by AllocMany takes in the slice (aka the heap)
7474// CAUTION: be careful not to double free, and prefer using defer to deallocate
7575func FreeMany [T any ](a Allocator , slice []T ) {
76- a .Free ( unsafe .Pointer (& slice [0 ]))
76+ a .free ( a . allocator , unsafe .Pointer (& slice [0 ]))
7777}
7878
7979// Realloc reallocates memory allocated with AllocMany and doesn't change underling data
8080func Realloc [T any ](a Allocator , slice []T , newN int ) []T {
81- ptr := a .Realloc ( unsafe .Pointer (& slice [0 ]), getSize [T ]()* newN )
81+ ptr := a .realloc ( a . allocator , unsafe .Pointer (& slice [0 ]), getSize [T ]()* newN )
8282 return unsafe .Slice (
8383 (* T )(ptr ),
8484 newN ,
0 commit comments