Re: Possibly incorrect size in memory profile structure

Marvin Häuser

Ahhh, I see it. The size does to describe the data structure that is existent at that point in time, but the one that is created by MemoryProfileCopyData() later, and the alignment is applied because it ends up as a flat structure array. Makes sense, thank you a lot!

Best regards,

On 22.06.21 12:20, Zeng, Star wrote:
Not sure I can understand your question correctly. But try best to recall and comment since not on it for long time. 😊

[2], [3] and [4] are all for interior storage management by MEMORY_PROFILE_DRIVER_INFO_DATA, MEMORY_PROFILE_DRIVER_INFO_DATA.PdbString points to the PDB string.

Exterior storage are managed by ProfileProtocolGetData() and MemoryProfileCopyData() from interior storage, 8B alignment are for exterior storage, PDB string is at the end of MEMORY_PROFILE_DRIVER_INFO structure.

-----Original Message-----
From: <> On Behalf Of Marvin Häuser
Sent: 2021年6月19日 18:56
To: Zeng, Star <>; Yao, Jiewen <>;
Subject: [edk2-devel] Possibly incorrect size in memory profile structure

Good day,

I have a question regarding a part of the memory profiling code. Namely this piece of code [1] introduced storing the PDB file name among the driver information. This is implement by a string pointer in the "MEMORY_PROFILE_DRIVER_INFO_DATA" structure (which embeds the "MEMORY_PROFILE_DRIVER_INFO" structure [2]). The length of the embedded "MEMORY_PROFILE_DRIVER_INFO" instance is set to the header size plus the 8B-aligned size of the PDB name [3], albeit its storage is not used for the PDB file name, and the storage that is used instead is not aligned by 8B [4]. Ominously, the interior structure does have a comment that indicates it is (or was) supposed to hold the PDB file name at some point [5].

I do not see that concept being used, and instead see the previously described way of storage, so I believe the aligned size is a forgotten piece from a refactoring. I imagine early on, the interior structure was supposed to hold the PDB name, and the alignment was needed to satisfy the following data's requirements. However, the change to the exterior storage should make this superfluous, and the specified size seems to be incorrect in all cases.

Can you please give this a quick look and help me determine whether this is a bug? Thank you for your time!

Best regards,






Join to automatically receive all group messages.