rewrite memory management documentation