1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-16 10:54:53 +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
const size_t OSD_MAllocHook::CollectBySize::myMaxAllocSize = MAX_ALLOC_SIZE;
void OSD_MAllocHook::CollectBySize::Reset()
{

View File

@ -132,7 +132,7 @@ public:
Standard_EXPORT virtual void AllocEvent(size_t, long);
Standard_EXPORT virtual void FreeEvent(void*, size_t, long);
private:
public:
struct Numbers
{
int nbAlloc;
@ -140,11 +140,13 @@ public:
int nbLeftPeak;
Numbers() : nbAlloc(0), nbFree(0), nbLeftPeak(0) {}
};
static const size_t myMaxAllocSize; //!< maximum tracked size
Standard_Mutex myMutex;
Numbers* myArray;
ptrdiff_t myTotalLeftSize;
size_t myTotalPeakSize;
Standard_Mutex myMutex; //!< used for thread-safe access
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;
};