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 859DBA0C46; Tue, 7 Sep 2021 10:53:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 193FC410EC; Tue, 7 Sep 2021 10:53:50 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by mails.dpdk.org (Postfix) with ESMTP id C8C69410EB for ; Tue, 7 Sep 2021 10:53:48 +0200 (CEST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 31D325C0100; Tue, 7 Sep 2021 04:53:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 07 Sep 2021 04:53:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm2; bh= 3I8KKUOa/veuSWhY2mcyAeIeiQDSTqyK/qlIZ4SAhIE=; b=ayX4Gluaij4bcGKB T5CKovZahM81ajT4k0khbn9p2r3o6vsUOMrTpDWSM/glIraqu7ROrl3pnG5Gd3+7 QtloJA101v6x+GkW4b2tKMxEbou3UDWTGHmZ9WjQpnH8tQq5Cp5ziqq6ITnSmRR4 oKLT/Vf0qxy5lgqdJg6zUJBVpM+McWUCX0wMz9UCebwaJUzPSDbesnEXZ6KNxqZ/ E5B7ygKB4BjYIfoDoO4AJ3leLyAsB595ZpIMQZZY26vG1wy+1EaIt9j1Kf/+Hy4j CXf6xmv0xVBudEReAXnVDnHq12kLBcCu6MTXIX47AO1L6QXg5egboTKEuVIRDUsL xKasEg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=3I8KKUOa/veuSWhY2mcyAeIeiQDSTqyK/qlIZ4SAh IE=; b=bWTKQuazitES/zyelWrsyKQsQsjTKLcP0zfIbAIK7bgX6Sy6/KyYwV5wC VAXomyTZ3H/91HGqkrWvQ6vS8hymghDXBty6aYw5Z2h0PysVWLWufYrvPCstlnGc bRvYsZSP2wdsxlHVaynlrYe7QE+kqjB+1wCgyAAvC4PlFZTM6ivHUK1l9T7yKgUn zV5y7iGLOwAPnM+gVZ9YZ6sVmCckT/iJJPKdhYfgzRkr07lk98AJgwBNn2uGkgyC JQgDRgEOCuIS3Wi8kdQjQ+gq9XUJ0BAq/mpatByMojwz3krVjWmR/4geRK0GP8Mh cHdd8ZCt731iBgM76eCk0z8SnG32g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudefhedgtdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 7 Sep 2021 04:53:46 -0400 (EDT) From: Thomas Monjalon To: Huisong Li Cc: dev@dpdk.org, ferruh.yigit@intel.com, david.marchand@redhat.com, lihuisong@huawei.com Date: Tue, 07 Sep 2021 10:53:44 +0200 Message-ID: <2757246.qzpMWD9H8a@thomas> In-Reply-To: <20210907034108.58763-1-lihuisong@huawei.com> References: <20210907034108.58763-1-lihuisong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [RFC V1] examples/l3fwd-power: fix memory leak for rte_pci_device 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 Sender: "dev" 07/09/2021 05:41, Huisong Li: > Calling rte_eth_dev_close() will release resources of eth device and close > it. But rte_pci_device struct isn't released when app exit, which will lead > to memory leak. That's a PMD issue. When the last port of a PCI device is closed, the device should be freed. > + /* Retrieve device address in eth device before closing it. */ > + eth_dev = &rte_eth_devices[portid]; You should not access this array, considered internal. > + rte_dev = eth_dev->device; > rte_eth_dev_close(portid); > + ret = rte_dev_remove(rte_dev);