Split free functions out of Pathfinder.cpp.