Should a task be created at the beginning of a program and destroyed at the end or should the task be created just before use and then destroyed immediately after use. The way I have been doing things so far has been the latter.
I am just curious if there are benefits to one way vs the other.
While either method will work fine, I recommend clearing the task as soon as you are finished with it. The benefit to this is that the resources that the task uses will be freed and you can use them again later in your program. If you don't clear the task when you are finished, then those resources will still be reserved. I hope that you find this information helpful.