Skip to content

Foundation: TaskManager memory leak #4949

@micheleselea

Description

@micheleselea

There is a not null probability that a taskmanager can leave memory leaks because can does not destroy task added. I managed to make it happens almost systematically on an embedded device.
The problem is that start do this

_threadPool.start(*pTask, pTask->name());
ScopedLockT lock(_mutex);
_taskList.push_back(pAutoTask);

than the taskfinished notify the observer and delete the task from list

We can hit the problem if we start the task, the thread run immediately and we end up in taskfinished before the
_taskList.push_back(pAutoTask);

I know it's some kind of anomaly situation, but, believe me, I get this a lot of time (almost systematically) in a day on a particular embedded environment (linux), and I used that code for years without problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions