[dpdk-dev] [RFC V1] examples/l3fwd-power: fix memory leak for rte_pci_device

Thomas Monjalon thomas at monjalon.net
Tue Sep 7 10:53:44 CEST 2021


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);





More information about the dev mailing list