1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-08 14:22:09 +03:00

feat(memory): custom OOM exception

This commit is contained in:
drrtuy
2025-04-18 22:51:15 +00:00
committed by Leonid Fedorov
parent e9973c46e4
commit af1864f544
4 changed files with 60 additions and 3 deletions

View File

@@ -22,7 +22,10 @@
#include <atomic>
#include <cstddef>
#include <cstdlib>
#include "atomicops.h"
#include "errorids.h"
#include "outofmemoryexcept.h"
namespace allocators
{
@@ -80,10 +83,10 @@ class CountingAllocator
if (currentGlobalMemoryLimit < memoryLimitLowerBound_)
{
atomicops::atomicAddRef(*memoryLimit_, lastMemoryLimitCheckpointDiff);
throw std::bad_alloc();
throw logging::OutOfMemoryExcept(logging::ERR_OUT_OF_MEMORY);
}
lastMemoryLimitCheckpoint_ += lastMemoryLimitCheckpointDiff;
}
}
currentLocalMemoryUsage_ += sizeChange;
}