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.

43 lines
1008 B

  1. // new and delete operators for debug CRT heap use by C++ Library
  2. #if defined(_DEBUG)
  3. #include <xdebug>
  4. #include <crtdbg.h>
  5. void *operator new(size_t sz, const std::_DebugHeapTag_t &tag,
  6. char *file, int line) _THROW1(std::bad_alloc)
  7. {
  8. void *p = _malloc_dbg(sz, tag._Type, file, line);
  9. if (p == 0)
  10. std::_Nomemory();
  11. return p;
  12. }
  13. void *operator new[](size_t sz, const std::_DebugHeapTag_t &tag,
  14. char *file, int line) _THROW1(std::bad_alloc)
  15. {
  16. return operator new(sz, tag, file, line);
  17. }
  18. void operator delete(void *p, const std::_DebugHeapTag_t &tag, char *, int)
  19. _THROW0()
  20. {
  21. _free_dbg(p, tag._Type);
  22. }
  23. void operator delete[](void *p, const std::_DebugHeapTag_t &tag,
  24. char *file, int line) _THROW0()
  25. {
  26. operator delete(p, tag, file, line);
  27. }
  28. _STD_BEGIN
  29. const _DebugHeapTag_t _DebugHeapTag = { _CRT_BLOCK };
  30. _STD_END
  31. #endif /* _DEBUG */
  32. /*
  33. * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED.
  34. * Consult your license regarding permissions and restrictions.
  35. V3.10:0009 */