started rewrite
mem tracing