summaryrefslogtreecommitdiffstats
path: root/private/mvdm/wow32/wheap.c
blob: b424e475e059358775b07b0704f31b1bf0127157 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//*****************************************************************************
//
// Small Heap -
//
//     This heap is used for allocating small size linked list structures.
//     This will reduce WOW's working set as the linked structures will be
//     together (less scattered) than if they were allocated from the
//     general purpose wow heap.
//
// 07-Oct-93  NanduriR   Created.
//
//*****************************************************************************

#include "precomp.h"
#pragma hdrstop

MODNAME(wheap.c);



HANDLE hWOWHeapSmall;


BOOL FASTCALL CreateSmallHeap()
{
  hWOWHeapSmall = HeapCreate (HEAP_NO_SERIALIZE, 4096, GROW_HEAP_AS_NEEDED);
  return (BOOL)hWOWHeapSmall;
}


PVOID FASTCALL malloc_w_small (ULONG size)
{
    PVOID pv = HeapAlloc(hWOWHeapSmall, 0, size);

#ifdef DEBUG
    if (pv == (PVOID)NULL) {
        LOGDEBUG(0, ("malloc_w_small: HeapAlloc failed\n"));
    }
#endif
    return pv;

}


BOOL FASTCALL free_w_small(PVOID p)
{
    return HeapFree(hWOWHeapSmall, 0, (LPSTR)(p));
}