Memory-safe tree traversals using arena allocators and the visitor pattern