Question About Task Cleanup

Are return task.done and taskMgr.remove equivalent?

In otherwords…

When a task returns task.done, is that task removed from the task manager (and memory) or does it just go inactive but remain in memory?

I assume taskMgr.remove, removes the task from task manager and from memory.

If task.done removes the task from the manager and memory, then calling taskMgr.remove can be skipped.

So, if you hasn’t another links to the task, then it should be removed from memory by the garbage collector I think.

Returning task.done should be sufficient. taskMgr.remove is a way to remove a task from outside of the task function itself.

The method itself will of course remain in memory, so you can always add taskMgr.add again on the same method.