change all file to new memory management