All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cosmin Banu <cosminb@gmail.com>
To: dev@dpdk.org
Subject: [dpdk-dev] memory leak reported by address sanitizer
Date: Thu, 3 Jun 2021 21:53:29 +0300	[thread overview]
Message-ID: <CA+sDxUPxr9c+7Tr4CN2MXbLxzVu4uw+GBXH3NFHWoDDb6FMRiw@mail.gmail.com> (raw)

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

                 reply	other threads:[~2021-06-07 19:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+sDxUPxr9c+7Tr4CN2MXbLxzVu4uw+GBXH3NFHWoDDb6FMRiw@mail.gmail.com \
    --to=cosminb@gmail.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.