Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save metarsit/326ca83b8435e26c4d02c82359821b02 to your computer and use it in GitHub Desktop.
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