MdeModulePkg DxeCore: Enhance memory profile for memory leak detection
1. Implement include GetRecordingState/SetRecordingState/Record for memory profile protocol. 2. Consume PcdMemoryProfilePropertyMask to support disable recording at the start. 3. Consume PcdMemoryProfileDriverPath to control which drivers need memory profile data. Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
@@ -276,7 +276,14 @@ CoreAllocatePool (
|
||||
|
||||
Status = CoreInternalAllocatePool (PoolType, Size, Buffer);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionAllocatePool, PoolType, Size, *Buffer);
|
||||
CoreUpdateProfile (
|
||||
(EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0),
|
||||
MemoryProfileActionAllocatePool,
|
||||
PoolType,
|
||||
Size,
|
||||
*Buffer,
|
||||
NULL
|
||||
);
|
||||
InstallMemoryAttributesTableOnMemoryAllocation (PoolType);
|
||||
}
|
||||
return Status;
|
||||
@@ -505,7 +512,14 @@ CoreFreePool (
|
||||
|
||||
Status = CoreInternalFreePool (Buffer, &PoolType);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePool, PoolType, 0, Buffer);
|
||||
CoreUpdateProfile (
|
||||
(EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0),
|
||||
MemoryProfileActionFreePool,
|
||||
PoolType,
|
||||
0,
|
||||
Buffer,
|
||||
NULL
|
||||
);
|
||||
InstallMemoryAttributesTableOnMemoryAllocation (PoolType);
|
||||
}
|
||||
return Status;
|
||||
|
Reference in New Issue
Block a user