[+] Added uOldLength to the free function pointer type of the memory leak detection interface
This commit is contained in:
parent
d4eab8e477
commit
fce755f293
@ -12,7 +12,7 @@
|
||||
namespace Aurora::Memory
|
||||
{
|
||||
using LeakFinderAlloc_f = void(__cdecl *)(void *, AuUInt);
|
||||
using LeakFinderFree_f = void(__cdecl *)(void *);
|
||||
using LeakFinderFree_f = void(__cdecl *)(void *, AuUInt);
|
||||
using MemoryLowNotification_f = void(__cdecl *)(AuUInt, int);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ namespace Aurora::Memory
|
||||
this->uBytesPeak = AuMax(this->uBytesPeak, this->uBytesAllocated);
|
||||
if (this->pAlloc)
|
||||
{
|
||||
this->pFree(pHead);
|
||||
this->pFree(pHead, uLengthCurrent);
|
||||
this->pAlloc(pThat, uLength);
|
||||
}
|
||||
return pThat;
|
||||
@ -169,7 +169,7 @@ namespace Aurora::Memory
|
||||
this->uBytesPeak = AuMax(this->uBytesPeak, this->uBytesAllocated);
|
||||
if (this->pAlloc)
|
||||
{
|
||||
this->pFree(pHead);
|
||||
this->pFree(pHead, uLengthCurrent);
|
||||
this->pAlloc(pThat, uLength);
|
||||
}
|
||||
return pThat;
|
||||
@ -200,7 +200,7 @@ namespace Aurora::Memory
|
||||
this->uBytesPeak = AuMax(this->uBytesPeak, this->uBytesAllocated);
|
||||
if (this->pAlloc)
|
||||
{
|
||||
this->pFree(pHead);
|
||||
this->pFree(pHead, uLengthCurrent);
|
||||
this->pAlloc(pThat, uLength);
|
||||
}
|
||||
return pThat;
|
||||
@ -231,7 +231,7 @@ namespace Aurora::Memory
|
||||
this->uBytesPeak = AuMax(this->uBytesPeak, this->uBytesAllocated);
|
||||
if (this->pAlloc)
|
||||
{
|
||||
this->pFree(pHead);
|
||||
this->pFree(pHead, uLengthCurrent);
|
||||
this->pAlloc(pThat, uLength);
|
||||
}
|
||||
return pThat;
|
||||
@ -256,7 +256,7 @@ namespace Aurora::Memory
|
||||
AuAtomicSub(&this->uBytesAllocated, uLengthCurrent);
|
||||
if (this->pAlloc)
|
||||
{
|
||||
this->pFree(pHead);
|
||||
this->pFree(pHead, uLengthCurrent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,11 +100,12 @@ namespace Aurora::Memory
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
auto uCount = ::mi_malloc_size(pRet); \
|
||||
if (gLeakFinderAlloc) \
|
||||
{ \
|
||||
gLeakFinderAlloc(pRet, ::mi_malloc_size(pRet)); \
|
||||
gLeakFinderAlloc(pRet, uCount); \
|
||||
} \
|
||||
AddBytesToCounter(::mi_malloc_size(pRet)); \
|
||||
AddBytesToCounter(uCount); \
|
||||
} \
|
||||
return pRet;
|
||||
|
||||
@ -158,7 +159,7 @@ namespace Aurora::Memory
|
||||
{
|
||||
if (gLeakFinderFree)
|
||||
{
|
||||
gLeakFinderFree(buffer);
|
||||
gLeakFinderFree(buffer, oldLen);
|
||||
}
|
||||
|
||||
gLeakFinderAlloc(pRet, uNewSize);
|
||||
@ -203,7 +204,7 @@ namespace Aurora::Memory
|
||||
{
|
||||
if (gLeakFinderFree)
|
||||
{
|
||||
gLeakFinderFree(buffer);
|
||||
gLeakFinderFree(buffer, oldLen);
|
||||
}
|
||||
|
||||
gLeakFinderAlloc(pRet, uNewSize);
|
||||
@ -248,7 +249,7 @@ namespace Aurora::Memory
|
||||
{
|
||||
if (gLeakFinderFree)
|
||||
{
|
||||
gLeakFinderFree(buffer);
|
||||
gLeakFinderFree(buffer, oldLen);
|
||||
}
|
||||
|
||||
gLeakFinderAlloc(pRet, uNewSize);
|
||||
@ -293,7 +294,7 @@ namespace Aurora::Memory
|
||||
{
|
||||
if (gLeakFinderFree)
|
||||
{
|
||||
gLeakFinderFree(buffer);
|
||||
gLeakFinderFree(buffer, oldLen);
|
||||
}
|
||||
|
||||
gLeakFinderAlloc(pRet, uNewSize);
|
||||
@ -325,13 +326,16 @@ namespace Aurora::Memory
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveBytesFromCounter(::mi_malloc_size(pHead));
|
||||
::mi_free(pHead);
|
||||
}
|
||||
auto uCount = ::mi_malloc_size(pHead);
|
||||
|
||||
if (gLeakFinderFree)
|
||||
{
|
||||
gLeakFinderFree(pHead);
|
||||
RemoveBytesFromCounter(uCount);
|
||||
::mi_free(pHead);
|
||||
|
||||
|
||||
if (gLeakFinderFree)
|
||||
{
|
||||
gLeakFinderFree(pHead, uCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user