app/testpmd: fix issue with memory leaks when quit testpmd
PATCH v2 1/1 app/testpmd: fix issue with memory leaks when quit testpmd
when dpdk is compiled in ASan, there is a memory leaks after quit testpmd if set mcast_addr, this patch fix this issue.
Error info as following:
ERROR: LeakSanitizer: detected memory leaksDirect leak of
192 byte(s) 0 0x7f6a2e0aeffe in __interceptor_realloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe) 1 0x565361eb340f in mcast_addr_pool_extend ../app/test-pmd/config.c:5162 2 0x565361eb3556 in mcast_addr_pool_append ../app/test-pmd/config.c:5180 3 0x565361eb3aae in mcast_addr_add ../app/test-pmd/config.c:5243
--- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+)
app/test-pmd/testpmd.c +6 -0
@@ -3136,6 +3136,12 @@ close_port(portid_t pid)continue ; } +if (port->mc_addr_nb !=0 ) { +/* free the pool of multicast addresses. */ +free (port->mc_addr_pool); + port->mc_addr_pool =NULL ; + } +if (is_proc_primary ()) {port_flow_flush (pi);port_flex_item_flush (pi);
Signature · 1 line
2.25.1
Hi Ke,
-----Original Message-----
From: Zhang, Ke1X <[email protected]>
Sent: 2022年3月14日 13:47
To: Li, Xiaoyun <[email protected]>; Singh, Aman Deep <[email protected]>; Zhang, Yuying <[email protected]>; [email protected]
Cc: Zhang, Ke1X <[email protected]>
Subject: [PATCH v2] app/testpmd: fix issue with memory leaks when quit testpmd
when dpdk is compiled in ASan, there is a memory leaks after quit testpmd if set mcast_addr, this patch fix this issue.
Error info as following:
ERROR: LeakSanitizer: detected memory leaksDirect leak of
192 byte(s) 0 0x7f6a2e0aeffe in __interceptor_realloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe) 1 0x565361eb340f in mcast_addr_pool_extend ../app/test-pmd/config.c:5162 2 0x565361eb3556 in mcast_addr_pool_append ../app/test-pmd/config.c:5180 3 0x565361eb3aae in mcast_addr_add ../app/test-pmd/config.c:5243
--- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+)
app/test-pmd/testpmd.c +6 -0
@@ -3136,6 +3136,12 @@ close_port(portid_t pid)continue ; } +if (port->mc_addr_nb !=0 ) { +/* free the pool of multicast addresses. */ +free (port->mc_addr_pool); + port->mc_addr_pool =NULL ; + } +
Is port->mc_addr_pool located in shared memory and may it be freed in primary process? BTW, you can write a function in config.c such as mcast_addr_pool_extend() and reference in close_port().
if (is_proc_primary()) {
port_flow_flush(pi);
port_flex_item_flush(pi);
--
2.25.1