Rémi Bernon : ntdll: Round free block size to block size alignment.
Alexandre Julliard
julliard at winehq.org
Thu Jun 2 16:26:09 CDT 2022
Module: wine
Branch: master
Commit: ff12dc1247f501d93b260586c4e702bff529e4d0
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ff12dc1247f501d93b260586c4e702bff529e4d0
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Mon May 30 14:19:16 2022 +0200
ntdll: Round free block size to block size alignment.
Block sizes are now always rounded to ALIGNMENT multiple, except for
the last free block in a region. This makes it consistent and will let
us use a more compact block layout.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/ntdll/heap.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index 0a6228217ff..3f14de39a1d 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -892,6 +892,7 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
SIZE_T commitSize, SIZE_T totalSize )
{
struct entry *pEntry;
+ SIZE_T block_size;
SUBHEAP *subheap;
unsigned int i;
@@ -991,9 +992,9 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
}
}
- /* Create the first free block */
-
- create_free_block( subheap, first_block( subheap ), subheap_size( subheap ) - subheap_overhead( subheap ) );
+ block_size = subheap_size( subheap ) - subheap_overhead( subheap );
+ block_size &= ~(ALIGNMENT - 1);
+ create_free_block( subheap, first_block( subheap ), block_size );
return subheap;
}
More information about the wine-cvs
mailing list