add memory manage