From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id EC0AF1B01B for ; Mon, 8 Jan 2018 11:17:17 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2018 02:17:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,330,1511856000"; d="scan'208";a="191306769" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by orsmga005.jf.intel.com with ESMTP; 08 Jan 2018 02:17:15 -0800 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.180]) by IRSMSX104.ger.corp.intel.com ([163.33.3.159]) with mapi id 14.03.0319.002; Mon, 8 Jan 2018 10:17:14 +0000 From: "Van Haaren, Harry" To: "Varghese, Vipin" , "dev@dpdk.org" CC: "Jain, Deepak K" Thread-Topic: [PATCH v1] service: fix memory leak by rte_service_init Thread-Index: AQHTghZ0E/mr1C+X3kKD8Z/upZLAZ6NpzuOQ Date: Mon, 8 Jan 2018 10:17:14 +0000 Message-ID: References: <1514731568-3979-1-git-send-email-vipin.varghese@intel.com> In-Reply-To: <1514731568-3979-1-git-send-email-vipin.varghese@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjE1ZTkxYzAtZjExYS00MmM2LTkzNTItYzE1NDA0ZWVmZjM2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IjhoZlNiWlZaVFh6Nk5sbnMyb2UweTVCakZoUVhERXZ4c28rbDNtKzdRSmM9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v1] service: fix memory leak by rte_service_init X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 10:17:18 -0000 > From: Varghese, Vipin > Sent: Sunday, December 31, 2017 2:46 PM > To: dev@dpdk.org; Van Haaren, Harry > Cc: Jain, Deepak K ; Varghese, Vipin > > Subject: [PATCH v1] service: fix memory leak by rte_service_init >=20 > This patch fixes the memory leak created by rte_service_init, when > run from secondary application. Running secondary application which > shares the huge page memory from primary multiple times causes memory > to be initialized but not free when application exit. >=20 > The rte_service_deinit check if the service is initialized. If yes, it > frees up rte_services & lcore_states. The API has to be called at end of > application run. >=20 > Signed-off-by: Vipin Varghese > +++ b/lib/librte_eal/common/rte_service.c > @@ -98,6 +98,20 @@ struct core_state { > static struct core_state *lcore_states; > static uint32_t rte_service_library_initialized; >=20 > +void rte_service_deinit(void) > +{ > + if (rte_service_library_initialized) { > + if (rte_services) > + rte_free(rte_services); > + if (lcore_states) > + rte_free(lcore_states); > + > + rte_service_library_initialized =3D 0; > + } > + return; > +} No return required from void functions > + > + > int32_t rte_service_init(void) > { > if (rte_service_library_initialized) { > diff --git a/lib/librte_eal/rte_eal_version.map > b/lib/librte_eal/rte_eal_version.map > index f4f46c1..0f14409 100644 > --- a/lib/librte_eal/rte_eal_version.map > +++ b/lib/librte_eal/rte_eal_version.map > @@ -234,5 +234,6 @@ EXPERIMENTAL { > rte_service_set_runstate_mapped_check; > rte_service_set_stats_enable; > rte_service_start_with_defaults; > + rte_service_deinit; Alphabetical ordering in the .map files (vim has a nice feature; visual sel= ect service functions then :sort ) With above changes; Acked-by: Harry van Haaren