mirror of
https://github.com/reactos/reactos.git
synced 2024-08-12 06:06:27 +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
|
@ -13,6 +13,10 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* TYPES *********************************************************************/
|
||||||
|
|
||||||
|
extern SYSTEM_BASIC_INFORMATION BaseCachedSysInfo;
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -31,6 +35,17 @@ HeapCreate(DWORD flOptions,
|
||||||
Flags = (flOptions & (HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE)) |
|
Flags = (flOptions & (HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE)) |
|
||||||
HEAP_CLASS_1;
|
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 */
|
/* Call RTL Heap */
|
||||||
hRet = RtlCreateHeap(Flags,
|
hRet = RtlCreateHeap(Flags,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
Loading…
Reference in a new issue