mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0024380: OSD_MAllocHook - Improvement of malloc hook to follow maximal peack size
This commit is contained in:
parent
f823def059
commit
941a7a240c
@ -470,7 +470,8 @@ OSD_MAllocHook::CollectBySize::CollectBySize()
|
||||
: myArray(NULL),
|
||||
myTotalLeftSize(0),
|
||||
myTotalPeakSize(0),
|
||||
myBreakSize(0)
|
||||
myBreakSize(0),
|
||||
myBreakPeak(0)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
@ -587,7 +588,18 @@ void OSD_MAllocHook::CollectBySize::AllocEvent
|
||||
myTotalLeftSize += theSize;
|
||||
int nbLeft = myArray[ind].nbAlloc - myArray[ind].nbFree;
|
||||
if (nbLeft > myArray[ind].nbLeftPeak)
|
||||
{
|
||||
myArray[ind].nbLeftPeak = nbLeft;
|
||||
if (myBreakPeak != 0
|
||||
&& (myBreakSize == theSize || myBreakSize == 0))
|
||||
{
|
||||
const Standard_Size aSizePeak = myArray[ind].nbLeftPeak * theSize;
|
||||
if (aSizePeak > myBreakPeak)
|
||||
{
|
||||
place_for_breakpoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (myTotalLeftSize > (ptrdiff_t)myTotalPeakSize)
|
||||
myTotalPeakSize = myTotalLeftSize;
|
||||
myMutex.Unlock();
|
||||
|
@ -148,7 +148,8 @@ public:
|
||||
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; //!< user defined allocation size to debug (see place_for_breakpoint())
|
||||
size_t myBreakPeak; //!< user defined peak size limit to debug
|
||||
};
|
||||
|
||||
//! Set handler of allocation/deallocation events
|
||||
|
Loading…
x
Reference in New Issue
Block a user