Calculate memory before assigning paths