Update the allocator to try to force memory to be allocated on an 8-byte boundary.

svn path=/trunk/; revision=6283
This commit is contained in:
Mark Tempel 2003-10-11 21:03:50 +00:00
parent 77d1c7d4ce
commit d3116f3c9e

View file

@ -113,7 +113,7 @@ typedef struct tagHEAP
#define HEAP_MAGIC ((DWORD)('H' | ('E'<<8) | ('A'<<16) | ('P'<<24))) #define HEAP_MAGIC ((DWORD)('H' | ('E'<<8) | ('A'<<16) | ('P'<<24)))
#define HEAP_DEF_SIZE 0x110000 /* Default heap size = 1Mb + 64Kb */ #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 */ #define COMMIT_MASK 0xffff /* bitmask for commit/decommit granularity */
@ -1125,7 +1125,7 @@ RtlDestroyHeap(HANDLE heap) /* [in] Handle of heap */
* RETURNS * RETURNS
* Pointer to allocated memory block * Pointer to allocated memory block
* NULL: Failure * NULL: Failure
* * 0x7d030f60--invalid flags in RtlHeapAllocate
* @implemented * @implemented
*/ */
PVOID STDCALL 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 &= HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY;
flags |= heapPtr->flags; flags |= heapPtr->flags;
if (!(flags & HEAP_NO_SERIALIZE)) RtlEnterCriticalSection( &heapPtr->critSection ); 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; if (size < HEAP_MIN_BLOCK_SIZE) size = HEAP_MIN_BLOCK_SIZE;
/* Locate a suitable free block */ /* Locate a suitable free block */
@ -1250,7 +1250,7 @@ BOOLEAN STDCALL RtlFreeHeap(
* RETURNS * RETURNS
* Pointer to reallocated memory block * Pointer to reallocated memory block
* NULL: Failure * NULL: Failure
* * 0x7d030f60--invalid flags in RtlHeapAllocate
* @implemented * @implemented
*/ */
LPVOID STDCALL RtlReAllocateHeap( LPVOID STDCALL RtlReAllocateHeap(
@ -1272,7 +1272,7 @@ LPVOID STDCALL RtlReAllocateHeap(
flags &= HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY | flags &= HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY |
HEAP_REALLOC_IN_PLACE_ONLY; HEAP_REALLOC_IN_PLACE_ONLY;
flags |= heapPtr->flags; flags |= heapPtr->flags;
size = (size + 3) & ~3; size = (size + 7) & ~7;
if (size < HEAP_MIN_BLOCK_SIZE) size = HEAP_MIN_BLOCK_SIZE; if (size < HEAP_MIN_BLOCK_SIZE) size = HEAP_MIN_BLOCK_SIZE;
if (!(flags & HEAP_NO_SERIALIZE)) RtlEnterCriticalSection( &heapPtr->critSection ); if (!(flags & HEAP_NO_SERIALIZE)) RtlEnterCriticalSection( &heapPtr->critSection );