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.

89 lines
1.0 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. memory.cxx
  5. Abstract:
  6. Common memory utility routines.
  7. Author:
  8. Gopal Parupudi <GopalP>
  9. [Notes:]
  10. optional-notes
  11. Revision History:
  12. GopalP 1/15/1999 Start.
  13. --*/
  14. #include <rpc.h>
  15. //
  16. // Externs
  17. //
  18. extern HANDLE ghNotifyHeap;
  19. //
  20. // Common allocator.
  21. //
  22. void * __cdecl
  23. operator new(
  24. IN size_t size
  25. )
  26. {
  27. return (HeapAlloc(ghNotifyHeap, 0, size));
  28. }
  29. void __cdecl
  30. operator delete(
  31. IN void * lpvObj
  32. )
  33. /*++
  34. Notes:
  35. a. We depend on the fact that HeapFree() does the right
  36. thing when lpvObj is NULL.
  37. --*/
  38. {
  39. HeapFree(ghNotifyHeap, 0, lpvObj);
  40. }
  41. //
  42. // Allocator for MIDL stubs
  43. //
  44. extern "C" void __RPC_FAR * __RPC_API
  45. MIDL_user_allocate(
  46. IN size_t len
  47. )
  48. {
  49. return (new char[len]);
  50. }
  51. extern "C" void __RPC_API
  52. MIDL_user_free(
  53. IN void __RPC_FAR * ptr
  54. )
  55. {
  56. delete ptr;
  57. }