memory: rewrite memory metrics