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.

56 lines
987 B

  1. // Copyright (c) 1996-1999 Microsoft Corporation
  2. /* memtrack.h - debug memory allocation functions */
  3. #if 0
  4. #ifndef KERNEL_MODE
  5. #undef MemAllocZ
  6. #undef MemAlloc
  7. #undef MemFree
  8. PVOID MemAllocZ(DWORD) ;
  9. PVOID MemAlloc(DWORD) ;
  10. VOID MemFree(PVOID) ;
  11. #define MEMTRACK 1
  12. #endif
  13. #endif
  14. // insert into one source function:
  15. /* comment out here to prevent re-definition
  16. #ifdef MEMTRACK
  17. PVOID MemAllocZ(DWORD dwSize)
  18. {
  19. PVOID pv ;
  20. pv = (PVOID) LocalAlloc(LPTR, dwSize) ;
  21. ERR(("allocated %d zeroed bytes at address %X\n", dwSize, pv)) ;
  22. return(pv);
  23. }
  24. PVOID MemAlloc(DWORD dwSize) ;
  25. {
  26. PVOID pv ;
  27. pv = (PVOID) LocalAlloc(LMEM_FIXED, dwSize) ;
  28. ERR(("allocated %d bytes at address %X\n", dwSize, pv)) ;
  29. return(pv);
  30. }
  31. VOID MemFree(PVOID pv) ;
  32. {
  33. ERR(("Freeing memory at address %X\n", pv)) ;
  34. if(pv)
  35. LocalFree((HLOCAL) pv) ;
  36. return ;
  37. }
  38. #endif
  39. */