From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7C423A034C; Thu, 18 Aug 2022 16:53:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2AFF040694; Thu, 18 Aug 2022 16:53:55 +0200 (CEST) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by mails.dpdk.org (Postfix) with ESMTP id 310FA40156 for ; Thu, 18 Aug 2022 16:53:54 +0200 (CEST) Received: by mail-pg1-f172.google.com with SMTP id c24so1465014pgg.11 for ; Thu, 18 Aug 2022 07:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc; bh=1mmdMYK/bHiuleIbUH7Q1vMzHvLd7RCKorGgdUe6mrI=; b=gQDUYpGikV88q+vFOBA5FXJav5ceS4xTeWeXvLFGb3lcssNccjVO0P7j/pQeXJy+wG CpkGgWvzakM37M+YgBeEbljJ5r2TC3N65n7CFtOVHLCX/YSat00Rl60OYzsTxkKcigeo hc20OImZrQqxa0i6VYrBZ8w27TH4pTC9mH7KDvfsRKk3qgJco0qBno008nk1PRRg+lGW 4JVlvYAhWqsTAm7SulEugM7Gnsmhcexp8MBth5GSB/8RWrifJT8VcP4qBqPWjqXdwvZP ecxQ4I3abKeaAg3PJrdiCWrEae8niXPTReigvTOetuoToyYfuq6m1xtbZKJkruatOpxg GGSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=1mmdMYK/bHiuleIbUH7Q1vMzHvLd7RCKorGgdUe6mrI=; b=XaFW4uunM8dPnim9/Ft15mY5WranwSAk2neEhmA4ywo5UpuhcRs0lZ4u0HCgnWC9QR 57l07PxOd5U/qHijHtWjid+SNCMmcnGM6+SEQaXbWFZJ2WoQtngkPSSHR1FiTDKqsjKg fnGQjGuXrg140VG/DzrXfr15RDaRm2Xa0Amt5cuWohwOOFWVekqJdEpWxdNMISq1cH3F UJQxw0FG/HFkCTRQ3rEsXxuz5oD14+PeUMvaB1di04Kfd5nCPv3+jcfW1l+T0NbUCAiD KGCtKdU/GDdq3elzH6oCBqA+km8rXvVeGoASdWGRAnVdLLzCy6jrjmI7T7S8r1wenKi0 tPvA== X-Gm-Message-State: ACgBeo1Y44xAkJkb72K52y6lOTA2E4rGl44K4Ein6daKqz2IcX3pkz4X lr4RtNlj+IhhtqoM8vUrILfRhGoZLeBZUw== X-Google-Smtp-Source: AA6agR52qt4KKkQXryJRibVswBv6NM3yx7gCbR47sOve2OE+K/Y0t7aSiBt0RA7uJ2yVdb6pwTOd5Q== X-Received: by 2002:a63:6304:0:b0:427:6c6b:ad21 with SMTP id x4-20020a636304000000b004276c6bad21mr2733753pgb.115.1660834433139; Thu, 18 Aug 2022 07:53:53 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id e62-20020a621e41000000b0052da33fe7d2sm1763902pfe.95.2022.08.18.07.53.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 07:53:52 -0700 (PDT) Date: Thu, 18 Aug 2022 07:53:50 -0700 From: Stephen Hemminger To: Fidaullah Noonari Cc: maryam.tahhan@intel.com, dev@dpdk.org Subject: Re: [PATCH] app/proc-info: add rte_eal_cleanup() to avoid memory leak Message-ID: <20220818075350.1332b26b@hermes.local> In-Reply-To: <20220818113742.138791-1-fidaullah.noonari@emumba.com> References: <20220818113742.138791-1-fidaullah.noonari@emumba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, 18 Aug 2022 16:37:42 +0500 Fidaullah Noonari wrote: > when app is launched with -m proc-info exit without > rte_eal_cleanup() causing memory leakage. This commit resolves the > memory leakage issue and closes app properly. > > Bugzilla id: 898 > > Signed-off-by: Fidaullah Noonari > --- > app/proc-info/main.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/app/proc-info/main.c b/app/proc-info/main.c > index 1bfba5f60d..44a946045e 100644 > --- a/app/proc-info/main.c > +++ b/app/proc-info/main.c > @@ -1523,6 +1523,9 @@ main(int argc, char **argv) > > if (mem_info) { > meminfo_display(); > + ret = rte_eal_cleanup(); > + if (ret != 0) > + printf("Error from rte_eal_cleanup(), %d\n", ret); A goto would avoid duplicating code: diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 1bfba5f60d10..9cfcce31ab9a 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -1523,7 +1523,7 @@ main(int argc, char **argv) if (mem_info) { meminfo_display(); - return 0; + goto cleanup; } nb_ports = rte_eth_dev_count_avail(); @@ -1593,6 +1593,7 @@ main(int argc, char **argv) RTE_ETH_FOREACH_DEV(i) rte_eth_dev_close(i); +cleanup: ret = rte_eal_cleanup(); if (ret) printf("Error from rte_eal_cleanup(), %d\n", ret);