mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
[HEAP]
- Properly set HEAP_GROWABLE flag if dwMaximumSize is 0 in HeapCreate. Also check for dwMaximumSize validity. Fixes out-of-memory problems when running "heavy" applications like Office 2003 setup with a new heap manager (which actually respects HEAP_GROWABLE flag). svn path=/trunk/; revision=49102
This commit is contained in:
parent
e45344cae1
commit
b00e93abd1
1 changed files with 15 additions and 0 deletions
|
@ -13,6 +13,10 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* TYPES *********************************************************************/
|
||||
|
||||
extern SYSTEM_BASIC_INFORMATION BaseCachedSysInfo;
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -31,6 +35,17 @@ HeapCreate(DWORD flOptions,
|
|||
Flags = (flOptions & (HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE)) |
|
||||
HEAP_CLASS_1;
|
||||
|
||||
/* Check if heap is growable and ensure max size is correct */
|
||||
if (dwMaximumSize == 0)
|
||||
Flags |= HEAP_GROWABLE;
|
||||
else if (dwMaximumSize < BaseCachedSysInfo.PageSize &&
|
||||
dwInitialSize > dwMaximumSize)
|
||||
{
|
||||
/* Max size is non-zero but less than page size which can't be correct.
|
||||
Fix it up by bumping it to the initial size whatever it is. */
|
||||
dwMaximumSize = dwInitialSize;
|
||||
}
|
||||
|
||||
/* Call RTL Heap */
|
||||
hRet = RtlCreateHeap(Flags,
|
||||
NULL,
|
||||
|
|
Loading…
Reference in a new issue