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.

51 lines
1.5 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: DynamicObject.h
  3. //
  4. // Copyright (c) 1999-2000, Microsoft Corporation
  5. //
  6. // Base class that implements operator new and operator delete for memory
  7. // usage tracking.
  8. //
  9. // History: 1999-09-22 vtan created
  10. // 2000-02-01 vtan moved from Neptune to Whistler
  11. // --------------------------------------------------------------------------
  12. #include "StandardHeader.h"
  13. #include "DynamicObject.h"
  14. // --------------------------------------------------------------------------
  15. // CDynamicObject::operator new
  16. //
  17. // Arguments: iSize = Size of memory to allocate (in bytes).
  18. //
  19. // Returns: <none>
  20. //
  21. // Purpose: Allocates a block of memory for a dynamic object.
  22. //
  23. // History: 1999-09-22 vtan created
  24. // --------------------------------------------------------------------------
  25. void* CDynamicObject::operator new (size_t uiSize)
  26. {
  27. return(LocalAlloc(LMEM_FIXED, uiSize));
  28. }
  29. // --------------------------------------------------------------------------
  30. // CDynamicObject::operator delete
  31. //
  32. // Arguments: pObject = Address of memory block to delete.
  33. //
  34. // Returns: <none>
  35. //
  36. // Purpose: Deallocates a block of memory for a dynamic object.
  37. //
  38. // History: 1999-09-22 vtan created
  39. // --------------------------------------------------------------------------
  40. void CDynamicObject::operator delete (void *pvObject)
  41. {
  42. (HLOCAL)LocalFree(pvObject);
  43. }