mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[NTOSKRNL]
When a VAD is truncated using VirtualFree, truncate the corresponding MemoryArea so new allocations will match in both spaces. svn path=/trunk/; revision=56727
This commit is contained in:
parent
343744d08b
commit
cdb1c62cd1
1 changed files with 7 additions and 0 deletions
|
@ -4214,6 +4214,8 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
//
|
//
|
||||||
if ((EndingAddress >> PAGE_SHIFT) == Vad->EndingVpn)
|
if ((EndingAddress >> PAGE_SHIFT) == Vad->EndingVpn)
|
||||||
{
|
{
|
||||||
|
PMEMORY_AREA MemoryArea;
|
||||||
|
|
||||||
//
|
//
|
||||||
// This is pretty easy and similar to case A. We compute the
|
// This is pretty easy and similar to case A. We compute the
|
||||||
// amount of pages to decommit, update the VAD's commit charge
|
// amount of pages to decommit, update the VAD's commit charge
|
||||||
|
@ -4226,7 +4228,12 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
Vad,
|
Vad,
|
||||||
Process);
|
Process);
|
||||||
Vad->u.VadFlags.CommitCharge -= CommitReduction;
|
Vad->u.VadFlags.CommitCharge -= CommitReduction;
|
||||||
|
// For ReactOS: shrink the corresponding memory area
|
||||||
|
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, (PVOID)StartingAddress);
|
||||||
|
ASSERT(Vad->StartingVpn << PAGE_SHIFT == (ULONG_PTR)MemoryArea->StartingAddress);
|
||||||
|
ASSERT((Vad->EndingVpn + 1) << PAGE_SHIFT == (ULONG_PTR)MemoryArea->EndingAddress);
|
||||||
Vad->EndingVpn = ((ULONG_PTR)StartingAddress - 1) >> PAGE_SHIFT;
|
Vad->EndingVpn = ((ULONG_PTR)StartingAddress - 1) >> PAGE_SHIFT;
|
||||||
|
MemoryArea->EndingAddress = (PVOID)(((Vad->EndingVpn + 1) << PAGE_SHIFT) - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue