From 398edefe0661b12a2b013e22587016b492589ad5 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 24 Mar 2013 17:19:59 +0000 Subject: LeakFinder: Factored in the housekeeping overhead git-svn-id: http://mc-server.googlecode.com/svn/trunk@1310 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/LeakFinder.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source') 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 { 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"); -- cgit v1.2.3