Add AST memory management.