sonic-net / sonic-swss

SONiC Switch State Service (SwSS)
https://azure.github.io/SONiC
Other
179 stars 537 forks source link

A memory leak point on Orch when addExecutor #3372

Open Pterosaur opened 1 week ago

Pterosaur commented 1 week ago

An executor was added into the m_comsumerMap, but this executor's pointer will not be released in the destructor of Orch. The lifetime of executor is ambiguous.

https://github.com/sonic-net/sonic-swss/blob/e8d81b44bbfebb741468b86371364df2b1c8c0d5/orchagent/portsorch.cpp#L707

https://github.com/sonic-net/sonic-swss/blob/e8d81b44bbfebb741468b86371364df2b1c8c0d5/orchagent/orch.cpp#L794-L799

https://github.com/sonic-net/sonic-swss/blob/e8d81b44bbfebb741468b86371364df2b1c8c0d5/orchagent/orch.h#L226

Pterosaur commented 1 week ago

Maybe to use a shared pointer to manage the executor is better.