add 2 debugging functions: 1) maintain log 2) show memory usage