add memory profiler and fix syntax error