Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DxeCore allocates way too much memory (Bugzilla Bug 295) #9569

Open
tianocore-issues opened this issue Dec 15, 2016 · 4 comments
Open

DxeCore allocates way too much memory (Bugzilla Bug 295) #9569

tianocore-issues opened this issue Dec 15, 2016 · 4 comments
Labels
package:mdemodulepkg priority:medium Moderate impact. Should be prioritized over lower priority issues. type:bug Something isn't working

Comments

@tianocore-issues
Copy link

This issue was created automatically with bugzilla2github

Bugzilla Bug 295

Date: 2016-12-15T00:26:01+00:00
From: Michael Zimmermann <>
To: @lzeng14
CC: nobody, yonghong.zhu

Last updated: 2016-12-15T19:05:45+00:00

@tianocore-issues
Copy link
Author

Comment 1166

Date: 2016-12-15 00:26:01 +0000
From: Michael Zimmermann <>

  • Industry Specification: ---
  • Releases to Fix: EDK II Master
  • Target OS: ---
  • Bugzilla Assignee(s): @lzeng14

Apparently, DxeCore takes the highest memory descriptor which is big enough and allocates it completely.

So if I have one memory resource descriptor for 0x80000000-0xffffffff then DxeCore allocates almost all of it(excluding the stack I guess).
In the debug log it looks like this:

CoreInitializeMemoryServices:
BaseAddress - 0x80000000 Length - 0x7E000000 MinimalMemorySizeNeeded - 0x501A000

and later on this range gets allocated:
GCD:AllocateMemorySpace(Base=0000000080000000,Length=000000007E000000) GcdAllocateType = AtAddress
GcdMemoryType = SystemMem
Alignment = 0000000000000001
ImageHandle = FDE28F90
DeviceHandle = 0
Status = Success (BaseAddress = 0000000080000000)
GCDMemType Range Capabilities Attributes
========== ================================= ================ ================
NonExist 0000000000000000-000000007FFFFFFF 0000000000000000 0000000000000000
SystemMem 0000000080000000-00000000FDFFFFFF 800000000000000E 0000000000000000*
NonExist 00000000FE000000-00000000FE3FFFFF 0000000000000000 0000000000000000
SystemMem 00000000FE400000-00000000FFFFFFFF 800000000000000E 0000000000000000

All of this is not a problem until I try to reserve smaller chunks of memory using memory allocation hobs pre-DxeCore because these will be allocated after DxeCore's giant allocation.

@tianocore-issues
Copy link
Author

Comment 1167

Date: 2016-12-15 00:34:21 +0000
From: nobody <>

DxeCore CoreInitializeMemoryServices() tries to find the highest available memory range as the first allocated memory region. But, it doesn't consider the allocation memory hob. In the submitter's case, the highest chunk memory range is reserved as the allocation memory hob in PEI phase. DxeCore still allocates it to rewrite the memory resource.

@tianocore-issues
Copy link
Author

Comment 1168

Date: 2016-12-15 00:47:43 +0000
From: Michael Zimmermann <>

I think this could be solved by processing the memory allocation hob's at the very beginning.
I currently have 4 other allocations before the Hob's are processed which means that there are many possibilities for accidentally allocating reserved memory depending on what your layout looks like.

@tianocore-issues
Copy link
Author

Comment 1172

Date: 2016-12-15 19:05:45 +0000
From: Yonghong Zhu <<yonghong.zhu>>

Bug scrub: Assign to module owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:mdemodulepkg priority:medium Moderate impact. Should be prioritized over lower priority issues. type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant