From d3116f3c9e1cbd56aed73db25f57949704f1f863 Mon Sep 17 00:00:00 2001 From: Mark Tempel Date: Sat, 11 Oct 2003 21:03:50 +0000 Subject: [PATCH] Update the allocator to try to force memory to be allocated on an 8-byte boundary. svn path=/trunk/; revision=6283 --- reactos/lib/ntdll/rtl/heap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reactos/lib/ntdll/rtl/heap.c b/reactos/lib/ntdll/rtl/heap.c index b205d442731..6b2a872f217 100644 --- a/reactos/lib/ntdll/rtl/heap.c +++ b/reactos/lib/ntdll/rtl/heap.c @@ -113,7 +113,7 @@ typedef struct tagHEAP #define HEAP_MAGIC ((DWORD)('H' | ('E'<<8) | ('A'<<16) | ('P'<<24))) #define HEAP_DEF_SIZE 0x110000 /* Default heap size = 1Mb + 64Kb */ -#define HEAP_MIN_BLOCK_SIZE (8+sizeof(ARENA_FREE)) /* Min. heap block size */ +#define HEAP_MIN_BLOCK_SIZE (sizeof(ARENA_FREE) + 8) /* Min. heap block size */ #define COMMIT_MASK 0xffff /* bitmask for commit/decommit granularity */ @@ -1125,7 +1125,7 @@ RtlDestroyHeap(HANDLE heap) /* [in] Handle of heap */ * RETURNS * Pointer to allocated memory block * NULL: Failure - * + * 0x7d030f60--invalid flags in RtlHeapAllocate * @implemented */ PVOID STDCALL @@ -1148,7 +1148,7 @@ RtlAllocateHeap(HANDLE heap, /* [in] Handle of private heap block */ flags &= HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY; flags |= heapPtr->flags; if (!(flags & HEAP_NO_SERIALIZE)) RtlEnterCriticalSection( &heapPtr->critSection ); - size = (size + 3) & ~3; + size = (size + 7) & ~7; if (size < HEAP_MIN_BLOCK_SIZE) size = HEAP_MIN_BLOCK_SIZE; /* Locate a suitable free block */ @@ -1250,7 +1250,7 @@ BOOLEAN STDCALL RtlFreeHeap( * RETURNS * Pointer to reallocated memory block * NULL: Failure - * + * 0x7d030f60--invalid flags in RtlHeapAllocate * @implemented */ LPVOID STDCALL RtlReAllocateHeap( @@ -1272,7 +1272,7 @@ LPVOID STDCALL RtlReAllocateHeap( flags &= HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY | HEAP_REALLOC_IN_PLACE_ONLY; flags |= heapPtr->flags; - size = (size + 3) & ~3; + size = (size + 7) & ~7; if (size < HEAP_MIN_BLOCK_SIZE) size = HEAP_MIN_BLOCK_SIZE; if (!(flags & HEAP_NO_SERIALIZE)) RtlEnterCriticalSection( &heapPtr->critSection );