Team Fortress 2 Source Code as on 22/4/2020
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.

33 lines
1.1 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #ifndef MEM_HELPERS_H
  7. #define MEM_HELPERS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. // Normally, the runtime libraries like to mess with the memory returned by malloc(),
  12. // which can create problems trying to repro bugs in debug builds or in the debugger.
  13. //
  14. // If the debugger is present, it initializes data to 0xbaadf00d, which makes floating
  15. // point numbers come out to about 0.1.
  16. //
  17. // If the debugger is not present, and it's a debug build, then you get 0xcdcdcdcd,
  18. // which is about 25 million.
  19. //
  20. // Otherwise, you get uninitialized memory.
  21. //
  22. // In here, we make sure the memory is either random garbage, or it's set to
  23. // 0xffeeffee, which casts to a NAN.
  24. extern bool g_bInitMemory;
  25. #define ApplyMemoryInitializations( pMem, nSize ) if ( !g_bInitMemory ) ; else { DoApplyMemoryInitializations( pMem, nSize ); }
  26. void DoApplyMemoryInitializations( void *pMem, size_t nSize );
  27. size_t CalcHeapUsed();
  28. #endif // MEM_HELPERS_H