Reduced heap usage in path generator