Right now I'm intentionally not cleaning up any memory since it will be handled as part of an arena once it's ported to Ion.
As for why it's copied, the reason is that some of the memory is temporary (like the memory for stretchy buffers) and some of it is persistent (like the memory for the AST). The current use cases doesn't really depend on or exploit that distinction, but once the compiler is used as a library it should be more obvious. The parser will then produce an AST (and associated data like the intern table) which will persist until the user decides to dispense with it, but any temporary memory that was used to produce it like the stretchy buffers will be immediately freed once parsing is complete.