[dpdk-dev] memory leak reported by address sanitizer
Cosmin Banu
cosminb at gmail.com
Thu Jun 3 20:53:29 CEST 2021
Hello,
After a recent DPDK upgrade I noticed a memory leak on exit when running
with address sanitizer:
=================================================================
==2260==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 3805032 byte(s) in 71 object(s) allocated from:
#0 0x7fa6cffb6bc8 in malloc
(/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
#1 0x55e4ee478a76 in pci_scan_one ../drivers/bus/pci/linux/pci.c:225
#2 0x55e4ee4795d5 in rte_pci_scan ../drivers/bus/pci/linux/pci.c:487
#3 0x55e4ee539552 in rte_bus_scan
../lib/librte_eal/common/eal_common_bus.c:50
#4 0x55e4ee566217 in rte_eal_init ../lib/librte_eal/linux/eal.c:1065
After a bit of digging, it looks like the issue is the following return
statement:
https://github.com/DPDK/dpdk/blob/v20.11/drivers/bus/pci/linux/pci.c#L335
The behavior changed in this commit:
https://github.com/DPDK/dpdk/commit/c79a1c67465d0193b52e2ae4b64dd8362c575b2b
The issue can be fixed by either freeing the memory, or adding the device:
free(dev);
// or
rte_pci_add_device(dev);
However, I don't know which is the correct behavior.
I would appreciate any feedback.
Thank you,
Cosmin
More information about the dev
mailing list