Skip to content

Instantly share code, notes, and snippets.

@metarsit
Created February 12, 2023 17:22
Show Gist options
  • Select an option

  • Save metarsit/e5791e6763348a61ae14634751975bcb to your computer and use it in GitHub Desktop.

Select an option

Save metarsit/e5791e6763348a61ae14634751975bcb to your computer and use it in GitHub Desktop.
package main
import (
"arena"
)
func main() {
mem := arena.NewArena()
defer mem.Free() // Free the arena memory after out of scope
// Allocate objects from the arena.
intObj := arena.New[int](mem)
boolObj := arena.New[bool](mem)
// and it supports many other types
// a slice with type, length, and capacity.
float64Slice := arena.MakeSlice[float64](mem, 100, 200)
// and many more other types
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment