properly release resources after recording, begin minimizing memory allocations, add more systraces