optimize memory controller, add memory handler to see how memory usage.