Re: [PATCH v1] [app/procinfo] fix memory leak - PCAP & service
From: Van Haaren, Harry <hidden>
Date: 2018-01-08 12:07:58
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Vipin Varghese Sent: Sunday, December 31, 2017 3:54 PM To: dev@dpdk.org Cc: Hunt, David <redacted>; Jain, Deepak K [off-list ref]; Varghese, Vipin [off-list ref] Subject: [dpdk-dev] [PATCH v1] [app/procinfo] fix memory leak - PCAP & service When procinfo uses the PCAP PMD it is not detached. The library service also makes of memory but never releases at exit of application. These leads to memory leak, on multiple runs. The patch add check for libpcap PMD check and detaches the same. The patch also frees the service library memory too. Signed-off-by: Vipin Varghese <redacted>
Hi, There are two fixes in this patch, please split into two patches: 1) PCAP PMD detach 2) service library deinit() For service library half of patch only, you can add: Acked-by: Harry van Haaren <redacted> For Ack of PCAP part, please CC PCAP maintainer. Regards, -Harry
quoted hunk ↗ jump to hunk
--- app/proc_info/main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)diff --git a/app/proc_info/main.c b/app/proc_info/main.c index 64fbbd0..44d9af9 100644 --- a/app/proc_info/main.c +++ b/app/proc_info/main.c@@ -58,6 +58,7 @@ #include <rte_branch_prediction.h> #include <rte_string_fns.h> #include <rte_metrics.h> +#include <rte_service.h> /* Maximum long option length for option parsing. */ #define MAX_LONG_OPT_SZ 64@@ -689,5 +690,24 @@ static void collectd_resolve_cnt_type(char *cnt_type,size_t cnt_type_len, if (enable_metrics) metrics_display(RTE_METRICS_GLOBAL); + for (i = 0; i < nb_ports; i++) { + struct rte_eth_dev_info dev_info = {0}; + char name[RTE_DEV_NAME_MAX_LEN] = {0}; + + rte_eth_dev_info_get(i, &dev_info); + if (strncmp(dev_info.driver_name, "net_pcap", 8) == 0) { + printf("port: %d driver_name: %s\n", + i, dev_info.driver_name); + rte_eth_dev_stop(i); + rte_eth_dev_close(i); + + ret = rte_eth_dev_detach(i, name); + if (ret) + rte_panic("Failed to detach %s\n", name); + } + } + + rte_service_deinit(); + return 0; } -- 1.9.1