Added memory profiling.