tl.find throws javascript heap out of memory error if the source folder is too large. That's probab;y because the tl.find function tries to load all the files in the source folder into memory before filtering for the file patterns
This issue was seen for CopyFiles@2 task and DeleteFiles@1 task, the issues created for azure-pipeline-tasks are linked below:
microsoft/azure-pipelines-tasks#21388
microsoft/azure-pipelines-tasks#20281
Using bash commands to delete/copy files works just fine. Replacing tl.find with fast-glob also resolves the issue. Reference PRs
microsoft/azure-pipelines-tasks#21385
microsoft/azure-pipelines-tasks#21395
But this should be fixed in the task lib.