8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 08:03:04 +01:00

Fixed memory statistics in debug build

This commit is contained in:
AlexPeshkoff 2024-04-19 20:25:04 +03:00 committed by Dmitry Yemanov
parent 1eb0c3d96a
commit c84e436248

View File

@ -368,7 +368,6 @@ public:
void resetExtent() void resetExtent()
{ {
fb_assert(isExtent());
hdrLength &= ~MEM_EXTENT; hdrLength &= ~MEM_EXTENT;
} }
@ -394,6 +393,11 @@ public:
{ {
return hdrLength & MEM_ACTIVE; return hdrLength & MEM_ACTIVE;
} }
#else
bool isActive() const
{
return true;
}
#endif #endif
void assertBig() void assertBig()
@ -2048,6 +2052,8 @@ MemPool::~MemPool(void)
} }
else else
block->resetActive(); block->resetActive();
block->resetExtent();
#endif #endif
parent->releaseBlock(block, false); parent->releaseBlock(block, false);
} }
@ -2269,8 +2275,7 @@ void MemPool::releaseMemory(void* object, bool flagExtent) noexcept
#ifdef VALIDATE_POOL #ifdef VALIDATE_POOL
MutexLockGuard guard(pool->mutex, "MemPool::releaseMemory"); MutexLockGuard guard(pool->mutex, "MemPool::releaseMemory");
#endif #endif
if (flagExtent) fb_assert(block->isExtent() == flagExtent);
block->resetExtent();
#ifdef DELAYED_FREE #ifdef DELAYED_FREE
// Synchronize delayed free queue using pool mutex // Synchronize delayed free queue using pool mutex
@ -2299,6 +2304,7 @@ void MemPool::releaseMemory(void* object, bool flagExtent) noexcept
block = pool->delayedFree[pool->delayedFreePos]; block = pool->delayedFree[pool->delayedFreePos];
object = &block->body; object = &block->body;
flagExtent = block->isExtent();
// Replace element in circular buffer // Replace element in circular buffer
pool->delayedFree[pool->delayedFreePos] = requested_block; pool->delayedFree[pool->delayedFreePos] = requested_block;
@ -2316,6 +2322,7 @@ void MemPool::releaseMemory(void* object, bool flagExtent) noexcept
#endif #endif
// Finally delete it // Finally delete it
block->resetExtent();
pool->releaseBlock(block, !flagExtent); pool->releaseBlock(block, !flagExtent);
} }
} }