Created
February 12, 2023 17:22
-
-
Save metarsit/e5791e6763348a61ae14634751975bcb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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