[dpdk-dev] app/pdump: fix the memory leak by rte_service_init

Message ID 1516780491-4554-1-git-send-email-vipin.varghese@intel.com (mailing list archive)
State Rejected, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Varghese, Vipin Jan. 24, 2018, 7:54 a.m. UTC
  When pdump is run multiple times against any primary application,
it consumes huge page memory by rte_service_init. This is not freed
at exit of application.

Invoking rte_service_finalize to free memory and prevent memory leak.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
---
 app/pdump/main.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Van Haaren, Harry Jan. 26, 2018, 3:44 p.m. UTC | #1
> From: Varghese, Vipin
> Sent: Wednesday, January 24, 2018 7:55 AM
> To: Van Haaren, Harry <harry.van.haaren@intel.com>; dev@dpdk.org
> Cc: Jain, Deepak K <deepak.k.jain@intel.com>; Mcnamara, John
> <john.mcnamara@intel.com>; stable@dpdk.org; Patel, Amol
> <amol.patel@intel.com>; Varghese, Vipin <vipin.varghese@intel.com>
> Subject: [PATCH] app/pdump: fix the memory leak by rte_service_init
> 
> When pdump is run multiple times against any primary application,
> it consumes huge page memory by rte_service_init. This is not freed
> at exit of application.
> 
> Invoking rte_service_finalize to free memory and prevent memory leak.
> 
> Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>

Thanks Vipin.

Note that this fixes a hugepages memory leak that would otherwise
occur when a secondary process initializes EAL and then quits.

Note that this patch depends on the patch adding rte_service_finalize()
http://dpdk.org/dev/patchwork/patch/34555/

Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
  

Patch

diff --git a/app/pdump/main.c b/app/pdump/main.c
index 0f70c75..9d03366 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -25,6 +25,7 @@ 
 #include <rte_mempool.h>
 #include <rte_ring.h>
 #include <rte_pdump.h>
+#include <rte_service.h>
 
 #define CMD_LINE_OPT_PDUMP "pdump"
 #define PDUMP_PORT_ARG "port"
@@ -882,5 +883,7 @@  struct parse_val {
 	/* dump debug stats */
 	print_pdump_stats();
 
+	rte_service_finalize();
+
 	return 0;
 }