int AsyncUpdator::EnqueueTask(TaskInfo task_info) {
- auto task = [=] {
- this->DoTask(task_info);
- };
+ auto task = std::bind(AsyncUpdator::DoTask, task_info);
return 0;
}
< /code>
struct TaskInfo {
GetRequest get_request; // this is a protobuffer structure
uint64_t log_id;
};
< /code>
The red lines (Lambda function) cause the leak, but the green lines (std::bind) don't?
Подробнее здесь: https://stackoverflow.com/questions/594 ... emory-leak