diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-24 18:19:59 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-24 18:19:59 +0100 |
commit | 398edefe0661b12a2b013e22587016b492589ad5 (patch) | |
tree | 0158aacb2228d4a5ffc0d8f3a46e5fc4b1c2c4d8 /source/LeakFinder.cpp | |
parent | Changed memory leak detection value to 65970823. Also added support for compiling in Visual Studio 2012. (diff) | |
download | cuberite-398edefe0661b12a2b013e22587016b492589ad5.tar cuberite-398edefe0661b12a2b013e22587016b492589ad5.tar.gz cuberite-398edefe0661b12a2b013e22587016b492589ad5.tar.bz2 cuberite-398edefe0661b12a2b013e22587016b492589ad5.tar.lz cuberite-398edefe0661b12a2b013e22587016b492589ad5.tar.xz cuberite-398edefe0661b12a2b013e22587016b492589ad5.tar.zst cuberite-398edefe0661b12a2b013e22587016b492589ad5.zip |
Diffstat (limited to '')
-rw-r--r-- | source/LeakFinder.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/LeakFinder.cpp b/source/LeakFinder.cpp index df4aff613..6439ff331 100644 --- a/source/LeakFinder.cpp +++ b/source/LeakFinder.cpp @@ -393,8 +393,8 @@ protected: virtual LONG Disable() = 0; // enables the leak-finder again... virtual LONG Enable() = 0; - -private: + +protected: // Entry for each allocation typedef struct AllocHashEntryType { HASHTABLE_KEY key; @@ -678,6 +678,9 @@ static LONG s_CrtDisableCount = 0; static LONG s_lMallocCalled = 0; + + + class CRTTable : public ContextHashtableBase<LONG> { public: @@ -725,6 +728,8 @@ public: #endif } + static const int AllocHashEntryTypeSize = sizeof(AllocHashEntryType); + protected: CHAR *m_pBuffer; SIZE_T m_maxBufferLen; @@ -885,9 +890,9 @@ static int MyAllocHook(int nAllocType, void *pvData, { if (lRequest != 0) // Always a valid RequestID should be provided (see comments in the header) { - g_CurrentMemUsage += nSize; + g_CurrentMemUsage += nSize + CRTTable::AllocHashEntryTypeSize; - if (g_CurrentMemUsage > 65970823)//1024 * 1024 * 1024) + if (g_CurrentMemUsage > 1024 * 1024 * 1024) { printf("******************************************\n"); printf("** Server reached 1 GiB memory usage, **\n"); |