Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.0 KiB

  1. //*****************************************************************************
  2. //
  3. // Small Heap -
  4. //
  5. // This heap is used for allocating small size linked list structures.
  6. // This will reduce WOW's working set as the linked structures will be
  7. // together (less scattered) than if they were allocated from the
  8. // general purpose wow heap.
  9. //
  10. // 07-Oct-93 NanduriR Created.
  11. //
  12. //*****************************************************************************
  13. #include "precomp.h"
  14. #pragma hdrstop
  15. MODNAME(wheap.c);
  16. HANDLE hWOWHeapSmall;
  17. BOOL FASTCALL CreateSmallHeap()
  18. {
  19. hWOWHeapSmall = HeapCreate (HEAP_NO_SERIALIZE, 4096, GROW_HEAP_AS_NEEDED);
  20. return (BOOL)hWOWHeapSmall;
  21. }
  22. PVOID FASTCALL malloc_w_small (ULONG size)
  23. {
  24. PVOID pv = HeapAlloc(hWOWHeapSmall, 0, size);
  25. #ifdef DEBUG
  26. if (pv == (PVOID)NULL) {
  27. LOGDEBUG(0, ("malloc_w_small: HeapAlloc failed\n"));
  28. }
  29. #endif
  30. return pv;
  31. }
  32. BOOL FASTCALL free_w_small(PVOID p)
  33. {
  34. return HeapFree(hWOWHeapSmall, 0, (LPSTR)(p));
  35. }