Created
February 12, 2023 17:13
-
-
Save metarsit/326ca83b8435e26c4d02c82359821b02 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" | |
| "fmt" | |
| ) | |
| type T struct { | |
| S string | |
| } | |
| func main() { | |
| mem := arena.NewArena() | |
| o1 := arena.New[T](mem) // Arena memory | |
| o2 := arena.Clone(o1) // Heap memory | |
| fmt.Println(o1 == o2) // false: Not the same object | |
| mem.Free() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment