Memory Leaks observed in PCI IO Protocol

Sandeep Dhanvada


I am using edk2(commit id: 0f1946b) with X64 ARCH, GCC49 toolchain and using PCI IO Protocol functions for memory Allocation/Map and Free/Unmap.

As per our NIC driver requirement, there is a need of 1600 bytes(MTU) of allocated memory for 6KB depth of descriptors pre-allocated at initialization and freed at unload. I am observing memory leak while continuously performing load and unload iterations of driver from UEFI Shell.

I simulated this in OVMF with PCI passthrough and observed leaks in this case also. Attached is the SampleDriver which uses PCI IO Protocol which Allocates and Maps memory while initialization and will Free and Unmap in unload path. In OVMF case, 12KB memory is leaked after every load unload iteration of Sample Driver.

Not sure if this expected behavior or indeed a memory leak.

Join to automatically receive all group messages.