1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-30 12:14:08 +03:00

0023393: Improve usability of OSD_MAllocHook::CollectBySize

Usability of OSD_MAllocHook::CollectBySize was improved:
- fields of OSD_MAllocHook::CollectBySize are made public (not private) to enable access for debugging purposes.
- added field myMaxAllocSize to denote maximum tracked size
This commit is contained in:
Roman Lygin 2012-08-19 11:01:32 +04:00
parent 536416f3d2
commit 1cc1abe1ab
2 changed files with 8 additions and 5 deletions

View File

@ -452,6 +452,7 @@ OSD_MAllocHook::CollectBySize::~CollectBySize()
//======================================================================= //=======================================================================
#define MAX_ALLOC_SIZE 2000000u #define MAX_ALLOC_SIZE 2000000u
const size_t OSD_MAllocHook::CollectBySize::myMaxAllocSize = MAX_ALLOC_SIZE;
void OSD_MAllocHook::CollectBySize::Reset() void OSD_MAllocHook::CollectBySize::Reset()
{ {

View File

@ -132,7 +132,7 @@ public:
Standard_EXPORT virtual void AllocEvent(size_t, long); Standard_EXPORT virtual void AllocEvent(size_t, long);
Standard_EXPORT virtual void FreeEvent(void*, size_t, long); Standard_EXPORT virtual void FreeEvent(void*, size_t, long);
private: public:
struct Numbers struct Numbers
{ {
int nbAlloc; int nbAlloc;
@ -141,10 +141,12 @@ public:
Numbers() : nbAlloc(0), nbFree(0), nbLeftPeak(0) {} Numbers() : nbAlloc(0), nbFree(0), nbLeftPeak(0) {}
}; };
Standard_Mutex myMutex; static const size_t myMaxAllocSize; //!< maximum tracked size
Numbers* myArray;
ptrdiff_t myTotalLeftSize; Standard_Mutex myMutex; //!< used for thread-safe access
size_t myTotalPeakSize; Numbers* myArray; //!< indexed from 0 to myMaxAllocSize-1
ptrdiff_t myTotalLeftSize; //!< currently remained allocated size
size_t myTotalPeakSize; //!< maxium cumulative allocated size
size_t myBreakSize; size_t myBreakSize;
}; };