xenia
xenia copied to clipboard
[Memory] VirtualAlloc behaviour while reusing allocated page
I found out that actual behaviour of VirtualAlloc isn't exactly correct.
Affected methods: BaseHeap::AllocFixed
, BaseHeap::AllocRange
(probably)
Actual Behaviour
Right now when we're recommiting already commited page it clears that page content, which is incorrect.
Expected Behaviour
If we have already commited page and trying to recommit or reserve (from what I understand you cannot reserve already reserved page, but you can reserve if it is commited) it then previous content should stay intact.
Microsoft Docs: https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc Test case: https://pastebin.com/ZVhff5Ec (Based of Microsoft example)
<placeholder 💃 >
Resolved in: https://github.com/xenia-project/xenia/pull/1718
Not fully resolved yet possibly — still need to validate the behavior in a range with both committed and uncommitted pages (currently only making the decision based on the original allocation region for the beginning of the range).
Sorry, my bad.