apply memory management