Source code of Windows XP (NT5)
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.

63 lines
1.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: heap.cxx
  7. //
  8. // Contents: memory management
  9. //
  10. // Classes:
  11. //
  12. // Functions: operator new
  13. // operator delete
  14. //
  15. // History: 5-Dec-95 JeffE Created
  16. //
  17. //--------------------------------------------------------------------------
  18. #include "headers.cxx"
  19. #pragma hdrstop
  20. //+---------------------------------------------------------------------------
  21. //
  22. // Function: operator new, public
  23. //
  24. // Synopsis: Global operator new which does not throw exceptions.
  25. //
  26. // Arguments: [size] -- Size of the memory to allocate.
  27. //
  28. // Returns: A pointer to the allocated memory. Is *NOT* initialized to 0!
  29. //
  30. // Notes: We override new to make delete easier.
  31. //
  32. //----------------------------------------------------------------------------
  33. void* __cdecl
  34. operator new (size_t size)
  35. {
  36. return(CoTaskMemAlloc(size));
  37. }
  38. //+-------------------------------------------------------------------------
  39. //
  40. // Function: ::operator delete
  41. //
  42. // Synopsis: Free a block of memory
  43. //
  44. // Arguments: [lpv] - block to free.
  45. //
  46. // History: 18-Nov-92 Ricksa Created
  47. //
  48. //--------------------------------------------------------------------------
  49. void __cdecl operator delete(void FAR* lpv)
  50. {
  51. CoTaskMemFree (lpv);
  52. }