migrate detect_mem