summaryrefslogtreecommitdiff
path: root/external/vpc/tier0/mem_helpers.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /external/vpc/tier0/mem_helpers.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'external/vpc/tier0/mem_helpers.h')
-rw-r--r--external/vpc/tier0/mem_helpers.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/external/vpc/tier0/mem_helpers.h b/external/vpc/tier0/mem_helpers.h
new file mode 100644
index 0000000..cdf2bfc
--- /dev/null
+++ b/external/vpc/tier0/mem_helpers.h
@@ -0,0 +1,33 @@
+//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
+//
+// Purpose:
+//
+//===========================================================================//
+
+#ifndef MEM_HELPERS_H
+#define MEM_HELPERS_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+// Normally, the runtime libraries like to mess with the memory returned by malloc(),
+// which can create problems trying to repro bugs in debug builds or in the debugger.
+//
+// If the debugger is present, it initializes data to 0xbaadf00d, which makes floating
+// point numbers come out to about 0.1.
+//
+// If the debugger is not present, and it's a debug build, then you get 0xcdcdcdcd,
+// which is about 25 million.
+//
+// Otherwise, you get uninitialized memory.
+//
+// In here, we make sure the memory is either random garbage, or it's set to
+// 0xffeeffee, which casts to a NAN.
+extern bool g_bInitMemory;
+#define ApplyMemoryInitializations( pMem, nSize ) if ( !g_bInitMemory ) ; else { DoApplyMemoryInitializations( pMem, nSize ); }
+void DoApplyMemoryInitializations( void *pMem, size_t nSize );
+
+size_t CalcHeapUsed();
+
+#endif // MEM_HELPERS_H